- int i;
- double sum_ssq_r = 0;
- double sum_ssq_a = 0;
-
- double df = factor->n_vars * (factor->n_vars - 1) / 2;
-
- double w = 0;
-
-
- double xsq;
-
- const int heading_columns = 2;
- const int heading_rows = 0;
-
- const int nr = heading_rows + 4;
- const int nc = heading_columns + 1;
-
- gsl_matrix *a, *x;
-
- struct tab_table *t = tab_create (nc, nr);
- tab_title (t, _("KMO and Bartlett's Test"));
-
- x = clone_matrix (idata->mm.corr);
- gsl_linalg_cholesky_decomp (x);
- gsl_linalg_cholesky_invert (x);
-
- a = anti_image (x);
-
- for (i = 0; i < x->size1; ++i)
- {
- sum_ssq_r += ssq_od_n (x, i);
- sum_ssq_a += ssq_od_n (a, i);
- }
-
- gsl_matrix_free (a);
- gsl_matrix_free (x);
-
- tab_headers (t, heading_columns, 0, heading_rows, 0);
-
- /* Outline the box */
- tab_box (t,
- TAL_2, TAL_2,
- -1, -1,
- 0, 0,
- nc - 1, nr - 1);
-
- tab_vline (t, TAL_2, heading_columns, 0, nr - 1);
-
- tab_text (t, 0, 0, TAT_TITLE | TAB_LEFT, _("Kaiser-Meyer-Olkin Measure of Sampling Adequacy"));
-
- tab_double (t, 2, 0, 0, sum_ssq_r / (sum_ssq_r + sum_ssq_a), NULL, RC_OTHER);
-
- tab_text (t, 0, 1, TAT_TITLE | TAB_LEFT, _("Bartlett's Test of Sphericity"));
-
- tab_text (t, 1, 1, TAT_TITLE, _("Approx. Chi-Square"));
- tab_text (t, 1, 2, TAT_TITLE, _("df"));
- tab_text (t, 1, 3, TAT_TITLE, _("Sig."));
-
+ struct pivot_table *table = pivot_table_create (
+ N_("KMO and Bartlett's Test"));
+
+ struct pivot_dimension *statistics = pivot_dimension_create (
+ table, PIVOT_AXIS_ROW, N_("Statistics"),
+ N_("Kaiser-Meyer-Olkin Measure of Sampling Adequacy"), PIVOT_RC_OTHER);
+ pivot_category_create_group (
+ statistics->root, N_("Bartlett's Test of Sphericity"),
+ N_("Approx. Chi-Square"), PIVOT_RC_OTHER,
+ N_("df"), PIVOT_RC_INTEGER,
+ N_("Sig."), PIVOT_RC_SIGNIFICANCE);