/* Routines to show the output tables */
static void show_anova_table (const struct oneway_spec *, const struct oneway_workspace *);
static void show_descriptives (const struct oneway_spec *);
-static void show_homogeneity (const struct oneway_spec *);
+static void show_homogeneity (const struct oneway_spec *, const struct oneway_workspace *);
static void output_oneway (const struct oneway_spec *, struct oneway_workspace *ws);
static void run_oneway (const struct oneway_spec *cmd, struct casereader *input, const struct dataset *ds);
ws.vws = xmalloc (cmd->n_vars * sizeof (*ws.vws));
+
for (v = 0; v < cmd->n_vars; ++v)
{
+ struct categoricals *cats = categoricals_create (&cmd->indep_var, 1,
+ cmd->wv, cmd->exclude);
+
ws.vws[v].cov = covariance_2pass_create (1, &cmd->vars[v],
- 1, &cmd->indep_var,
+ cats,
cmd->wv, cmd->exclude);
ws.vws[v].cc = 0;
}
}
}
-static void show_contrast_coeffs (const struct oneway_spec *cmd, struct oneway_workspace *ws);
-static void show_contrast_tests (const struct oneway_spec *cmd, struct oneway_workspace *ws);
+static void show_contrast_coeffs (const struct oneway_spec *cmd, const struct oneway_workspace *ws);
+static void show_contrast_tests (const struct oneway_spec *cmd, const struct oneway_workspace *ws);
static void
output_oneway (const struct oneway_spec *cmd, struct oneway_workspace *ws)
show_descriptives (cmd);
if (cmd->stats & STATS_HOMOGENEITY)
- show_homogeneity (cmd);
+ show_homogeneity (cmd, ws);
show_anova_table (cmd, ws);
/* Show the homogeneity table */
static void
-show_homogeneity (const struct oneway_spec *cmd)
+show_homogeneity (const struct oneway_spec *cmd, const struct oneway_workspace *ws)
{
size_t v;
int n_cols = 5;
tab_hline (t, TAL_2, 0, n_cols - 1, 1);
tab_vline (t, TAL_2, 1, 0, n_rows - 1);
-
tab_text (t, 1, 0, TAB_CENTER | TAT_TITLE, _("Levene Statistic"));
tab_text (t, 2, 0, TAB_CENTER | TAT_TITLE, _("df1"));
tab_text (t, 3, 0, TAB_CENTER | TAT_TITLE, _("df2"));
for (v = 0; v < cmd->n_vars; ++v)
{
- double F;
+ const struct per_var_ws *pvw = &ws->vws[v];
+ const struct categoricals *cats = covariance_get_categoricals (pvw->cov);
+
const struct variable *var = cmd->vars[v];
const struct group_proc *gp = group_proc_get (cmd->vars[v]);
const char *s = var_to_string (var);
- const struct group_statistics *totals = &gp->ugs;
- const double df1 = gp->n_groups - 1;
- const double df2 = totals->n - gp->n_groups;
+ const double df1 = pvw->n_groups - 1;
+ const double df2 = pvw->cc - pvw->n_groups;
+ double F = gp->levene;
tab_text (t, 0, v + 1, TAB_LEFT | TAT_TITLE, s);
- F = gp->levene;
+
tab_double (t, 1, v + 1, TAB_RIGHT, F, NULL);
tab_fixed (t, 2, v + 1, TAB_RIGHT, df1, 8, 0);
tab_fixed (t, 3, v + 1, TAB_RIGHT, df2, 8, 0);
/* Now the significance */
- tab_double (t, 4, v + 1, TAB_RIGHT,gsl_cdf_fdist_Q (F, df1, df2), NULL);
+ tab_double (t, 4, v + 1, TAB_RIGHT, gsl_cdf_fdist_Q (F, df1, df2), NULL);
}
tab_submit (t);
/* Show the contrast coefficients table */
static void
-show_contrast_coeffs (const struct oneway_spec *cmd, struct oneway_workspace *ws)
+show_contrast_coeffs (const struct oneway_spec *cmd, const struct oneway_workspace *ws)
{
int c_num = 0;
struct ll *cli;
int n_cols = 2 + ws->actual_number_of_groups;
int n_rows = 2 + n_contrasts;
- void *const *group_values;
-
struct tab_table *t;
+ const struct covariance *cov = ws->vws[0].cov ;
+
t = tab_create (n_cols, n_rows);
tab_headers (t, 2, 0, 2, 0);
tab_joint_text (t, 2, 0, n_cols - 1, 0, TAB_CENTER | TAT_TITLE,
var_to_string (cmd->indep_var));
- group_values = hsh_sort (ws->group_hash);
-
for ( cli = ll_head (&cmd->contrast_list);
cli != ll_null (&cmd->contrast_list);
cli = ll_next (cli))
{
int count = 0;
struct contrasts_node *cn = ll_data (cli, struct contrasts_node, ll);
- struct ll *coeffi = ll_head (&cn->coefficient_list);
+ struct ll *coeffi ;
tab_text_format (t, 1, c_num + 2, TAB_CENTER, "%d", c_num + 1);
- for (count = 0;
- count < hsh_count (ws->group_hash) && coeffi != ll_null (&cn->coefficient_list);
- ++count)
+ for (coeffi = ll_head (&cn->coefficient_list);
+ coeffi != ll_null (&cn->coefficient_list);
+ ++count, coeffi = ll_next (coeffi))
{
- double *group_value_p;
- union value group_value;
+ const struct categoricals *cats = covariance_get_categoricals (cov);
+ const union value *val = categoricals_get_value_by_subscript (cats, count);
struct string vstr;
ds_init_empty (&vstr);
- group_value_p = group_values[count];
- group_value.f = *group_value_p;
- var_append_value_name (cmd->indep_var, &group_value, &vstr);
+ var_append_value_name (cmd->indep_var, val, &vstr);
tab_text (t, count + 2, 1, TAB_CENTER | TAT_TITLE, ds_cstr (&vstr));
tab_text_format (t, count + 2, c_num + 2, TAB_RIGHT, "%g", coeffn->coeff);
}
-
- coeffi = ll_next (coeffi);
}
++c_num;
}
/* Show the results of the contrast tests */
static void
-show_contrast_tests (const struct oneway_spec *cmd, struct oneway_workspace *ws)
+show_contrast_tests (const struct oneway_spec *cmd, const struct oneway_workspace *ws)
{
int n_contrasts = ll_count (&cmd->contrast_list);
size_t v;