static void output_frequency_table (const struct two_sample_test *t2s, const struct sign_test_params *param, const struct dictionary *dict) { int i; struct tab_table *table = tab_create (3, 1 + 4 * t2s->n_pairs); const struct variable *wv = dict_get_weight (dict); const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0; tab_set_format (table, RC_WEIGHT, wfmt); tab_title (table, _("Frequencies")); tab_headers (table, 2, 0, 1, 0); /* Vertical lines inside the box */ tab_box (table, 0, 0, -1, TAL_1, 1, 0, tab_nc (table) - 1, tab_nr (table) - 1 ); /* Box around entire table */ tab_box (table, TAL_2, TAL_2, -1, -1, 0, 0, tab_nc (table) - 1, tab_nr (table) - 1 ); tab_text (table, 2, 0, TAB_CENTER, _("N")); for (i = 0 ; i < t2s->n_pairs; ++i) { variable_pair *vp = &t2s->pairs[i]; struct string pair_name; ds_init_cstr (&pair_name, var_to_string ((*vp)[0])); ds_put_cstr (&pair_name, " - "); ds_put_cstr (&pair_name, var_to_string ((*vp)[1])); tab_text (table, 0, 1 + i * 4, TAB_LEFT, ds_cstr (&pair_name)); ds_destroy (&pair_name); tab_hline (table, TAL_1, 0, tab_nc (table) - 1, 1 + i * 4); tab_text (table, 1, 1 + i * 4, TAB_LEFT, _("Negative Differences")); tab_text (table, 1, 2 + i * 4, TAB_LEFT, _("Positive Differences")); tab_text (table, 1, 3 + i * 4, TAB_LEFT, _("Ties")); tab_text (table, 1, 4 + i * 4, TAB_LEFT, _("Total")); tab_double (table, 2, 1 + i * 4, TAB_RIGHT, param[i].neg, NULL, RC_WEIGHT); tab_double (table, 2, 2 + i * 4, TAB_RIGHT, param[i].pos, NULL, RC_WEIGHT); tab_double (table, 2, 3 + i * 4, TAB_RIGHT, param[i].ties, NULL, RC_WEIGHT); tab_double (table, 2, 4 + i * 4, TAB_RIGHT, param[i].ties + param[i].neg + param[i].pos, NULL, RC_WEIGHT); } tab_submit (table); }
static void output_statistics_table (const struct two_sample_test *t2s, const struct sign_test_params *param) { int i; struct tab_table *table = tab_create (1 + t2s->n_pairs, 4); tab_title (table, _("Test Statistics")); tab_headers (table, 0, 1, 0, 1); tab_hline (table, TAL_2, 0, tab_nc (table) - 1, 1); tab_vline (table, TAL_2, 1, 0, tab_nr (table) - 1); /* Vertical lines inside the box */ tab_box (table, -1, -1, -1, TAL_1, 0, 0, tab_nc (table) - 1, tab_nr (table) - 1); /* Box around entire table */ tab_box (table, TAL_2, TAL_2, -1, -1, 0, 0, tab_nc (table) - 1, tab_nr (table) - 1); tab_text (table, 0, 1, TAT_TITLE | TAB_LEFT, _("Exact Sig. (2-tailed)")); tab_text (table, 0, 2, TAT_TITLE | TAB_LEFT, _("Exact Sig. (1-tailed)")); tab_text (table, 0, 3, TAT_TITLE | TAB_LEFT, _("Point Probability")); for (i = 0 ; i < t2s->n_pairs; ++i) { variable_pair *vp = &t2s->pairs[i]; struct string pair_name; ds_init_cstr (&pair_name, var_to_string ((*vp)[0])); ds_put_cstr (&pair_name, " - "); ds_put_cstr (&pair_name, var_to_string ((*vp)[1])); tab_text (table, 1 + i, 0, TAB_LEFT, ds_cstr (&pair_name)); ds_destroy (&pair_name); tab_double (table, 1 + i, 1, TAB_RIGHT, param[i].one_tailed_sig * 2, NULL, RC_PVALUE); tab_double (table, 1 + i, 2, TAB_RIGHT, param[i].one_tailed_sig, NULL, RC_PVALUE); tab_double (table, 1 + i, 3, TAB_RIGHT, param[i].point_prob, NULL, RC_PVALUE); } tab_submit (table); }
static void reliability_statistics_model_alpha (struct tab_table *tbl, const struct reliability *rel) { const struct variable *wv = rel->wv; const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0; const struct cronbach *s = &rel->sc[0]; tab_text (tbl, 0, 0, TAB_CENTER | TAT_TITLE, _("Cronbach's Alpha")); tab_text (tbl, 1, 0, TAB_CENTER | TAT_TITLE, _("N of Items")); tab_double (tbl, 0, 1, TAB_RIGHT, s->alpha, NULL); tab_double (tbl, 1, 1, TAB_RIGHT, s->n_items, wfmt); }
/* Append table T, which should have been returned by covariance_dump_enc_header with an entry corresponding to case C for the covariance matrix COV */ void covariance_dump_enc (const struct covariance *cov, const struct ccase *c, struct tab_table *t) { static int row = 0; int i; ++row; for (i = 0 ; i < cov->dim; ++i) { double v = get_val (cov, i, c); tab_double (t, i, row, 0, v, i < cov->n_vars ? NULL : &F_8_0, RC_OTHER); } }
static void reliability_statistics_model_split (struct tab_table *tbl, const struct reliability *rel) { const struct variable *wv = rel->wv; const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0; tab_text (tbl, 0, 0, TAB_LEFT, _("Cronbach's Alpha")); tab_text (tbl, 1, 0, TAB_LEFT, _("Part 1")); tab_text (tbl, 2, 0, TAB_LEFT, _("Value")); tab_text (tbl, 2, 1, TAB_LEFT, _("N of Items")); tab_text (tbl, 1, 2, TAB_LEFT, _("Part 2")); tab_text (tbl, 2, 2, TAB_LEFT, _("Value")); tab_text (tbl, 2, 3, TAB_LEFT, _("N of Items")); tab_text (tbl, 1, 4, TAB_LEFT, _("Total N of Items")); tab_text (tbl, 0, 5, TAB_LEFT, _("Correlation Between Forms")); tab_text (tbl, 0, 6, TAB_LEFT, _("Spearman-Brown Coefficient")); tab_text (tbl, 1, 6, TAB_LEFT, _("Equal Length")); tab_text (tbl, 1, 7, TAB_LEFT, _("Unequal Length")); tab_text (tbl, 0, 8, TAB_LEFT, _("Guttman Split-Half Coefficient")); tab_double (tbl, 3, 0, TAB_RIGHT, rel->sc[1].alpha, NULL); tab_double (tbl, 3, 2, TAB_RIGHT, rel->sc[2].alpha, NULL); tab_double (tbl, 3, 1, TAB_RIGHT, rel->sc[1].n_items, wfmt); tab_double (tbl, 3, 3, TAB_RIGHT, rel->sc[2].n_items, wfmt); tab_double (tbl, 3, 4, TAB_RIGHT, rel->sc[1].n_items + rel->sc[2].n_items, wfmt); { /* R is the correlation between the two parts */ double r = rel->sc[0].variance_of_sums - rel->sc[1].variance_of_sums - rel->sc[2].variance_of_sums ; /* Guttman Split Half Coefficient */ double g = 2 * r / rel->sc[0].variance_of_sums; /* Unequal Length Spearman Brown Coefficient, and intermediate value used in the computation thereof */ double uly, tmp; r /= sqrt (rel->sc[1].variance_of_sums); r /= sqrt (rel->sc[2].variance_of_sums); r /= 2.0; tab_double (tbl, 3, 5, TAB_RIGHT, r, NULL); /* Equal length Spearman-Brown Coefficient */ tab_double (tbl, 3, 6, TAB_RIGHT, 2 * r / (1.0 + r), NULL); tab_double (tbl, 3, 8, TAB_RIGHT, g, NULL); tmp = (1.0 - r*r) * rel->sc[1].n_items * rel->sc[2].n_items / pow2 (rel->sc[0].n_items); uly = sqrt( pow4 (r) + 4 * pow2 (r) * tmp); uly -= pow2 (r); uly /= 2 * tmp; tab_double (tbl, 3, 7, TAB_RIGHT, uly, NULL); } }
static void reliability_summary_total (const struct reliability *rel) { int i; const int n_cols = 5; const int heading_columns = 1; const int heading_rows = 1; const int n_rows = rel->sc[0].n_items + heading_rows ; struct tab_table *tbl = tab_create (n_cols, n_rows); tab_headers (tbl, heading_columns, 0, heading_rows, 0); tab_title (tbl, _("Item-Total Statistics")); /* Vertical lines for the data only */ tab_box (tbl, -1, -1, -1, TAL_1, heading_columns, 0, n_cols - 1, n_rows - 1); /* Box around table */ tab_box (tbl, TAL_2, TAL_2, -1, -1, 0, 0, n_cols - 1, n_rows - 1); tab_hline (tbl, TAL_2, 0, n_cols - 1, heading_rows); tab_vline (tbl, TAL_2, heading_columns, 0, n_rows - 1); tab_text (tbl, 1, 0, TAB_CENTER | TAT_TITLE, _("Scale Mean if Item Deleted")); tab_text (tbl, 2, 0, TAB_CENTER | TAT_TITLE, _("Scale Variance if Item Deleted")); tab_text (tbl, 3, 0, TAB_CENTER | TAT_TITLE, _("Corrected Item-Total Correlation")); tab_text (tbl, 4, 0, TAB_CENTER | TAT_TITLE, _("Cronbach's Alpha if Item Deleted")); for (i = 0 ; i < rel->sc[0].n_items; ++i) { double cov, item_to_total_r; double mean, weight, var; const struct cronbach *s = &rel->sc[rel->total_start + i]; tab_text (tbl, 0, heading_rows + i, TAB_LEFT| TAT_TITLE, var_to_string (rel->sc[0].items[i])); moments1_calculate (s->total, &weight, &mean, &var, 0, 0); tab_double (tbl, 1, heading_rows + i, TAB_RIGHT, mean, NULL); tab_double (tbl, 2, heading_rows + i, TAB_RIGHT, s->variance_of_sums, NULL); tab_double (tbl, 4, heading_rows + i, TAB_RIGHT, s->alpha, NULL); moments1_calculate (rel->sc[0].m[i], &weight, &mean, &var, 0,0); cov = rel->sc[0].variance_of_sums + var - s->variance_of_sums; cov /= 2.0; item_to_total_r = (cov - var) / (sqrt(var) * sqrt (s->variance_of_sums)); tab_double (tbl, 3, heading_rows + i, TAB_RIGHT, item_to_total_r, NULL); } tab_submit (tbl); }
static void case_processing_summary (casenumber n_valid, casenumber n_missing, const struct dictionary *dict) { const struct variable *wv = dict_get_weight (dict); const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0; casenumber total; int n_cols = 4; int n_rows = 4; int heading_columns = 2; int heading_rows = 1; struct tab_table *tbl; tbl = tab_create (n_cols, n_rows); tab_headers (tbl, heading_columns, 0, heading_rows, 0); tab_title (tbl, _("Case Processing Summary")); /* Vertical lines for the data only */ tab_box (tbl, -1, -1, -1, TAL_1, heading_columns, 0, n_cols - 1, n_rows - 1); /* Box around table */ tab_box (tbl, TAL_2, TAL_2, -1, -1, 0, 0, n_cols - 1, n_rows - 1); tab_hline (tbl, TAL_2, 0, n_cols - 1, heading_rows); tab_vline (tbl, TAL_2, heading_columns, 0, n_rows - 1); tab_text (tbl, 0, heading_rows, TAB_LEFT | TAT_TITLE, _("Cases")); tab_text (tbl, 1, heading_rows, TAB_LEFT | TAT_TITLE, _("Valid")); tab_text (tbl, 1, heading_rows + 1, TAB_LEFT | TAT_TITLE, _("Excluded")); tab_text (tbl, 1, heading_rows + 2, TAB_LEFT | TAT_TITLE, _("Total")); tab_text (tbl, heading_columns, 0, TAB_CENTER | TAT_TITLE, _("N")); tab_text (tbl, heading_columns + 1, 0, TAB_CENTER | TAT_TITLE, _("%")); total = n_missing + n_valid; tab_double (tbl, 2, heading_rows, TAB_RIGHT, n_valid, wfmt); tab_double (tbl, 2, heading_rows + 1, TAB_RIGHT, n_missing, wfmt); tab_double (tbl, 2, heading_rows + 2, TAB_RIGHT, total, wfmt); tab_double (tbl, 3, heading_rows, TAB_RIGHT, 100 * n_valid / (double) total, NULL); tab_double (tbl, 3, heading_rows + 1, TAB_RIGHT, 100 * n_missing / (double) total, NULL); tab_double (tbl, 3, heading_rows + 2, TAB_RIGHT, 100 * total / (double) total, NULL); tab_submit (tbl); }