- if (cmd.pivot == CRS_PIVOT)
- for (i = 0; i < nvar; i++)
- {
- if (i)
- cp = stpcpy (cp, " by ");
- cp = stpcpy (cp, var_get_name (x->vars[i]));
- }
- else
- {
- cp = spprintf (cp, "%s by %s for",
- var_get_name (x->vars[0]),
- var_get_name (x->vars[1]));
- for (i = 2; i < nvar; i++)
- {
- char buf[64], *bufp;
-
- if (i > 2)
- *cp++ = ',';
- *cp++ = ' ';
- cp = stpcpy (cp, var_get_name (x->vars[i]));
- *cp++ = '=';
- format_short (buf, var_get_print_format (x->vars[i]),
- &(*pb)->values[i]);
- for (bufp = buf; isspace ((unsigned char) *bufp); bufp++)
- ;
- cp = stpcpy (cp, bufp);
- }
- }
-
- cp = stpcpy (cp, " [");
- for (i = 0; i < num_cells; i++)
- {
- struct tuple
- {
- int value;
- const char *name;
- };
-
- static const struct tuple cell_names[] =
- {
- {CRS_CL_COUNT, N_("count")},
- {CRS_CL_ROW, N_("row %")},
- {CRS_CL_COLUMN, N_("column %")},
- {CRS_CL_TOTAL, N_("total %")},
- {CRS_CL_EXPECTED, N_("expected")},
- {CRS_CL_RESIDUAL, N_("residual")},
- {CRS_CL_SRESIDUAL, N_("std. resid.")},
- {CRS_CL_ASRESIDUAL, N_("adj. resid.")},
- {-1, NULL},
- };
-
- const struct tuple *t;
-
- for (t = cell_names; t->value != cells[i]; t++)
- assert (t->value != -1);
- if (i)
- cp = stpcpy (cp, ", ");
- cp = stpcpy (cp, gettext (t->name));
- }
- strcpy (cp, "].");
-
- tab_title (table, "%s", title);
- freea (title);
- }
-
- tab_offset (table, 0, 2);
- }
- else
- table = NULL;
-
- /* Chi-square table initialization. */
- if (cmd.a_statistics[CRS_ST_CHISQ])
- {
- chisq = tab_create (6 + (nvar - 2),
- (pe - pb) / n_cols * 3 / 2 * N_CHISQ + 10, 1);
- tab_headers (chisq, 1 + (nvar - 2), 0, 1, 0);
-
- tab_title (chisq, _("Chi-square tests."));
-
- tab_offset (chisq, nvar - 2, 0);
- tab_text (chisq, 0, 0, TAB_LEFT | TAT_TITLE, _("Statistic"));
- tab_text (chisq, 1, 0, TAB_RIGHT | TAT_TITLE, _("Value"));
- tab_text (chisq, 2, 0, TAB_RIGHT | TAT_TITLE, _("df"));
- tab_text (chisq, 3, 0, TAB_RIGHT | TAT_TITLE,
- _("Asymp. Sig. (2-sided)"));
- tab_text (chisq, 4, 0, TAB_RIGHT | TAT_TITLE,
- _("Exact. Sig. (2-sided)"));
- tab_text (chisq, 5, 0, TAB_RIGHT | TAT_TITLE,
- _("Exact. Sig. (1-sided)"));
- chisq_fisher = 0;
- tab_offset (chisq, 0, 1);
- }
- else
- chisq = NULL;
-
- /* Symmetric measures. */
- if (cmd.a_statistics[CRS_ST_PHI] || cmd.a_statistics[CRS_ST_CC]
- || cmd.a_statistics[CRS_ST_BTAU] || cmd.a_statistics[CRS_ST_CTAU]
- || cmd.a_statistics[CRS_ST_GAMMA] || cmd.a_statistics[CRS_ST_CORR]
- || cmd.a_statistics[CRS_ST_KAPPA])
- {
- sym = tab_create (6 + (nvar - 2), (pe - pb) / n_cols * 7 + 10, 1);
- tab_headers (sym, 2 + (nvar - 2), 0, 1, 0);
- tab_title (sym, _("Symmetric measures."));
-
- tab_offset (sym, nvar - 2, 0);
- tab_text (sym, 0, 0, TAB_LEFT | TAT_TITLE, _("Category"));
- tab_text (sym, 1, 0, TAB_LEFT | TAT_TITLE, _("Statistic"));
- tab_text (sym, 2, 0, TAB_RIGHT | TAT_TITLE, _("Value"));
- tab_text (sym, 3, 0, TAB_RIGHT | TAT_TITLE, _("Asymp. Std. Error"));
- tab_text (sym, 4, 0, TAB_RIGHT | TAT_TITLE, _("Approx. T"));
- tab_text (sym, 5, 0, TAB_RIGHT | TAT_TITLE, _("Approx. Sig."));
- tab_offset (sym, 0, 1);
- }
- else
- sym = NULL;
-
- /* Risk estimate. */
- if (cmd.a_statistics[CRS_ST_RISK])
- {
- risk = tab_create (4 + (nvar - 2), (pe - pb) / n_cols * 4 + 10, 1);
- tab_headers (risk, 1 + nvar - 2, 0, 2, 0);
- tab_title (risk, _("Risk estimate."));
-
- tab_offset (risk, nvar - 2, 0);
- tab_joint_text (risk, 2, 0, 3, 0, TAB_CENTER | TAT_TITLE | TAT_PRINTF,
- _("95%% Confidence Interval"));
- tab_text (risk, 0, 1, TAB_LEFT | TAT_TITLE, _("Statistic"));
- tab_text (risk, 1, 1, TAB_RIGHT | TAT_TITLE, _("Value"));
- tab_text (risk, 2, 1, TAB_RIGHT | TAT_TITLE, _("Lower"));
- tab_text (risk, 3, 1, TAB_RIGHT | TAT_TITLE, _("Upper"));
- tab_hline (risk, TAL_1, 2, 3, 1);
- tab_vline (risk, TAL_1, 2, 0, 1);
- tab_offset (risk, 0, 2);
- }
- else
- risk = NULL;
-
- /* Directional measures. */
- if (cmd.a_statistics[CRS_ST_LAMBDA] || cmd.a_statistics[CRS_ST_UC]
- || cmd.a_statistics[CRS_ST_D] || cmd.a_statistics[CRS_ST_ETA])
- {
- direct = tab_create (7 + (nvar - 2), (pe - pb) / n_cols * 7 + 10, 1);
- tab_headers (direct, 3 + (nvar - 2), 0, 1, 0);
- tab_title (direct, _("Directional measures."));
-
- tab_offset (direct, nvar - 2, 0);
- tab_text (direct, 0, 0, TAB_LEFT | TAT_TITLE, _("Category"));
- tab_text (direct, 1, 0, TAB_LEFT | TAT_TITLE, _("Statistic"));
- tab_text (direct, 2, 0, TAB_LEFT | TAT_TITLE, _("Type"));
- tab_text (direct, 3, 0, TAB_RIGHT | TAT_TITLE, _("Value"));
- tab_text (direct, 4, 0, TAB_RIGHT | TAT_TITLE, _("Asymp. Std. Error"));
- tab_text (direct, 5, 0, TAB_RIGHT | TAT_TITLE, _("Approx. T"));
- tab_text (direct, 6, 0, TAB_RIGHT | TAT_TITLE, _("Approx. Sig."));
- tab_offset (direct, 0, 1);
- }
- else
- direct = NULL;
-
- for (;;)
- {
- /* Find pivot subtable if applicable. */
- te = find_pivot_extent (tb, &tc, 0);
- if (te == NULL)
- break;
-
- /* Find all the row variable values. */
- enum_var_values (tb, te - tb, ROW_VAR, &rows, &n_rows);
-
- /* Allocate memory space for the column and row totals. */
- if (n_rows > *maxrows)
- {
- *row_totp = xnrealloc (*row_totp, n_rows, sizeof **row_totp);
- row_tot = *row_totp;
- *maxrows = n_rows;
- }
- if (n_cols > *maxcols)
- {
- *col_totp = xnrealloc (*col_totp, n_cols, sizeof **col_totp);
- col_tot = *col_totp;
- *maxcols = n_cols;
- }