X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fmcnemar.c;h=56fe088de6757c7812c48f9cc30aec4caf8541bf;hb=649c202d57d7d5d8bb87be5b72839cd56ca4ca0b;hp=53e9a52f526041b91fbf5621478fcd8f502a7927;hpb=7acdff072470c7e87ac9ba7c2f135e4c08fd0e02;p=pspp diff --git a/src/language/stats/mcnemar.c b/src/language/stats/mcnemar.c index 53e9a52f52..56fe088de6 100644 --- a/src/language/stats/mcnemar.c +++ b/src/language/stats/mcnemar.c @@ -82,7 +82,7 @@ mcnemar_execute (const struct dataset *ds, struct casereader *r = input; - struct mcnemar *mc = xcalloc (sizeof *mc, t2s->n_pairs); + struct mcnemar *mc = xcalloc (t2s->n_pairs, sizeof *mc); for (i = 0 ; i < t2s->n_pairs; ++i ) { @@ -174,6 +174,8 @@ output_freq_table (variable_pair *vp, struct string val1str ; struct string val0str ; + tab_set_format (table, RC_WEIGHT, wfmt); + ds_init_empty (&val0str); ds_init_empty (&val1str); @@ -184,7 +186,7 @@ output_freq_table (variable_pair *vp, ds_put_cstr (&pair_name, " & "); ds_put_cstr (&pair_name, var_to_string ((*vp)[1])); - tab_title (table, ds_cstr (&pair_name)); + tab_title (table, "%s", ds_cstr (&pair_name)); ds_destroy (&pair_name); @@ -213,10 +215,10 @@ output_freq_table (variable_pair *vp, tab_text (table, header_cols + 0, 1, TAB_LEFT, ds_cstr (&val0str)); tab_text (table, header_cols + 1, 1, TAB_LEFT, ds_cstr (&val1str)); - tab_double (table, header_cols + 0, header_rows + 0, TAB_RIGHT, param->n00, wfmt); - tab_double (table, header_cols + 0, header_rows + 1, TAB_RIGHT, param->n01, wfmt); - tab_double (table, header_cols + 1, header_rows + 0, TAB_RIGHT, param->n10, wfmt); - tab_double (table, header_cols + 1, header_rows + 1, TAB_RIGHT, param->n11, wfmt); + tab_double (table, header_cols + 0, header_rows + 0, TAB_RIGHT, param->n00, NULL, RC_WEIGHT); + tab_double (table, header_cols + 0, header_rows + 1, TAB_RIGHT, param->n01, NULL, RC_WEIGHT); + tab_double (table, header_cols + 1, header_rows + 0, TAB_RIGHT, param->n10, NULL, RC_WEIGHT); + tab_double (table, header_cols + 1, header_rows + 1, TAB_RIGHT, param->n11, NULL, RC_WEIGHT); tab_submit (table); @@ -238,6 +240,7 @@ output_statistics_table (const struct two_sample_test *t2s, const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0; tab_title (table, _("Test Statistics")); + tab_set_format (table, RC_WEIGHT, wfmt); tab_headers (table, 0, 1, 0, 1); @@ -280,15 +283,15 @@ output_statistics_table (const struct two_sample_test *t2s, tab_text (table, 0, 1 + i, TAB_LEFT, ds_cstr (&pair_name)); ds_destroy (&pair_name); - tab_double (table, 1, 1 + i, TAB_RIGHT, mc[i].n00 + mc[i].n01 + mc[i].n10 + mc[i].n11, wfmt); + tab_double (table, 1, 1 + i, TAB_RIGHT, mc[i].n00 + mc[i].n01 + mc[i].n10 + mc[i].n11, NULL, RC_WEIGHT); sig = gsl_cdf_binomial_P (mc[i].n01, 0.5, mc[i].n01 + mc[i].n10); - tab_double (table, 2, 1 + i, TAB_RIGHT, 2 * sig, NULL); - tab_double (table, 3, 1 + i, TAB_RIGHT, sig, NULL); + tab_double (table, 2, 1 + i, TAB_RIGHT, 2 * sig, NULL, RC_PVALUE); + tab_double (table, 3, 1 + i, TAB_RIGHT, sig, NULL, RC_PVALUE); tab_double (table, 4, 1 + i, TAB_RIGHT, gsl_ran_binomial_pdf (mc[i].n01, 0.5, mc[i].n01 + mc[i].n10), - NULL); + NULL, RC_OTHER); } tab_submit (table);