X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flanguage%2Fstats%2Ffactor.c;h=29e30c16b4b022b3eb26858507562dedc90f6d0e;hb=refs%2Ftags%2Ffc11-i386-build74;hp=b035fc8d8af1a9be69e1fabefadf9164dea6ed53;hpb=8b71948cd57dbd2787cb4c50525b957e9be8a62b;p=pspp-builds.git diff --git a/src/language/stats/factor.c b/src/language/stats/factor.c index b035fc8d..29e30c16 100644 --- a/src/language/stats/factor.c +++ b/src/language/stats/factor.c @@ -44,8 +44,10 @@ #include #include -#include +#include +#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -70,6 +72,12 @@ enum extraction_method EXTRACTION_PAF, }; +enum plot_opts + { + PLOT_SCREE = 0x0001, + PLOT_ROTATION = 0x0002 + }; + enum print_opts { PRINT_UNIVARIATE = 0x0001, @@ -100,6 +108,7 @@ struct cmd_factor enum mv_class exclude; enum print_opts print; enum extraction_method extraction; + enum plot_opts plot; /* Extraction Criteria */ int n_factors; @@ -526,6 +535,7 @@ cmd_factor (struct lexer *lexer, struct dataset *ds) factor.econverge = 0.001; factor.blank = 0; factor.sort = false; + factor.plot = 0; factor.wv = dict_get_weight (dict); @@ -546,7 +556,6 @@ cmd_factor (struct lexer *lexer, struct dataset *ds) { lex_match (lexer, '/'); -#if FACTOR_FULLY_IMPLEMENTED if (lex_match_id (lexer, "PLOT")) { lex_match (lexer, '='); @@ -554,10 +563,13 @@ cmd_factor (struct lexer *lexer, struct dataset *ds) { if (lex_match_id (lexer, "EIGEN")) { + factor.plot |= PLOT_SCREE; } +#if FACTOR_FULLY_IMPLEMENTED else if (lex_match_id (lexer, "ROTATION")) { } +#endif else { lex_error (lexer, NULL); @@ -565,9 +577,7 @@ cmd_factor (struct lexer *lexer, struct dataset *ds) } } } - else -#endif - if (lex_match_id (lexer, "METHOD")) + else if (lex_match_id (lexer, "METHOD")) { lex_match (lexer, '='); while (lex_token (lexer) != '.' && lex_token (lexer) != '/') @@ -911,6 +921,22 @@ communality (struct idata *idata, int n, int n_factors) } +static void +show_scree (const struct cmd_factor *f, struct idata *idata) +{ + struct scree *s; + const char *label ; + + if ( !(f->plot & PLOT_SCREE) ) + return; + + + label = f->extraction == EXTRACTION_PC ? _("Component Number") : _("Factor Number"); + + s = scree_create (idata->eval, label); + + scree_submit (s); +} static void show_communalities (const struct cmd_factor * factor, @@ -938,8 +964,6 @@ show_communalities (const struct cmd_factor * factor, tab_title (t, _("Communalities")); - tab_dim (t, tab_natural_dimensions, NULL, NULL); - tab_headers (t, heading_columns, 0, heading_rows, 0); c = 1; @@ -1001,8 +1025,6 @@ show_factor_matrix (const struct cmd_factor *factor, struct idata *idata, const else tab_title (t, _("Factor Matrix")); - tab_dim (t, tab_natural_dimensions, NULL, NULL); - tab_headers (t, heading_columns, 0, heading_rows, 0); if ( factor->extraction == EXTRACTION_PC ) @@ -1110,8 +1132,6 @@ show_explained_variance (const struct cmd_factor * factor, struct idata *idata, tab_title (t, _("Total Variance Explained")); - tab_dim (t, tab_natural_dimensions, NULL, NULL); - tab_headers (t, heading_columns, 0, heading_rows, 0); /* Outline the box */ @@ -1262,8 +1282,6 @@ show_correlation_matrix (const struct cmd_factor *factor, const struct idata *id tab_title (t, _("Correlation Matrix")); - tab_dim (t, tab_natural_dimensions, NULL, NULL); - tab_hline (t, TAL_1, 0, nc - 1, heading_rows); if (nr > heading_rows) @@ -1405,7 +1423,6 @@ do_factor (const struct cmd_factor *factor, struct casereader *r) struct tab_table *t = tab_create (nc, nr); tab_title (t, _("Descriptive Statistics")); - tab_dim (t, tab_natural_dimensions, NULL, NULL); tab_headers (t, heading_columns, 0, heading_rows, 0); @@ -1517,6 +1534,8 @@ do_factor (const struct cmd_factor *factor, struct casereader *r) factor_matrix_workspace_free (fmw); + show_scree (factor, idata); + show_factor_matrix (factor, idata, factor_matrix); gsl_vector_free (initial_communalities);