/* Intermediate values used in calculation */
const gsl_matrix *corr ; /* The correlation matrix */
- const gsl_matrix *cov ; /* The covariance matrix */
+ gsl_matrix *cov ; /* The covariance matrix */
const gsl_matrix *n ; /* Matrix of number of samples */
gsl_vector *eval ; /* The eigenvalues */
gsl_vector_free (id->msr);
gsl_vector_free (id->eval);
gsl_matrix_free (id->evec);
+ if (id->cov != NULL)
+ gsl_matrix_free (id->cov);
free (id);
}
+#if 0
static void
dump_matrix (const gsl_matrix *m)
{
}
printf ("\n");
}
+#endif
static int
factor.wv = dict_get_weight (dict);
- lex_match (lexer, '/');
+ lex_match (lexer, T_SLASH);
if (!lex_force_match_id (lexer, "VARIABLES"))
{
goto error;
}
- lex_match (lexer, '=');
+ lex_match (lexer, T_EQUALS);
if (!parse_variables_const (lexer, dict, &factor.vars, &factor.n_vars,
PV_NO_DUPLICATE | PV_NUMERIC))
if (factor.n_vars < 2)
msg (MW, _("Factor analysis on a single variable is not useful."));
- while (lex_token (lexer) != '.')
+ while (lex_token (lexer) != T_ENDCMD)
{
- lex_match (lexer, '/');
+ lex_match (lexer, T_SLASH);
if (lex_match_id (lexer, "PLOT"))
{
- lex_match (lexer, '=');
- while (lex_token (lexer) != '.' && lex_token (lexer) != '/')
+ lex_match (lexer, T_EQUALS);
+ while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
{
if (lex_match_id (lexer, "EIGEN"))
{
}
else if (lex_match_id (lexer, "METHOD"))
{
- lex_match (lexer, '=');
- while (lex_token (lexer) != '.' && lex_token (lexer) != '/')
+ lex_match (lexer, T_EQUALS);
+ while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
{
if (lex_match_id (lexer, "COVARIANCE"))
{
}
else if (lex_match_id (lexer, "ROTATION"))
{
- lex_match (lexer, '=');
- while (lex_token (lexer) != '.' && lex_token (lexer) != '/')
+ lex_match (lexer, T_EQUALS);
+ while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
{
/* VARIMAX and DEFAULT are defaults */
if (lex_match_id (lexer, "VARIMAX") || lex_match_id (lexer, "DEFAULT"))
}
else if (lex_match_id (lexer, "CRITERIA"))
{
- lex_match (lexer, '=');
- while (lex_token (lexer) != '.' && lex_token (lexer) != '/')
+ lex_match (lexer, T_EQUALS);
+ while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
{
if (lex_match_id (lexer, "FACTORS"))
{
- if ( lex_force_match (lexer, '('))
+ if ( lex_force_match (lexer, T_LPAREN))
{
lex_force_int (lexer);
factor.n_factors = lex_integer (lexer);
lex_get (lexer);
- lex_force_match (lexer, ')');
+ lex_force_match (lexer, T_RPAREN);
}
}
else if (lex_match_id (lexer, "MINEIGEN"))
{
- if ( lex_force_match (lexer, '('))
+ if ( lex_force_match (lexer, T_LPAREN))
{
lex_force_num (lexer);
factor.min_eigen = lex_number (lexer);
lex_get (lexer);
- lex_force_match (lexer, ')');
+ lex_force_match (lexer, T_RPAREN);
}
}
else if (lex_match_id (lexer, "ECONVERGE"))
{
- if ( lex_force_match (lexer, '('))
+ if ( lex_force_match (lexer, T_LPAREN))
{
lex_force_num (lexer);
factor.econverge = lex_number (lexer);
lex_get (lexer);
- lex_force_match (lexer, ')');
+ lex_force_match (lexer, T_RPAREN);
}
}
else if (lex_match_id (lexer, "RCONVERGE"))
{
- if ( lex_force_match (lexer, '('))
+ if ( lex_force_match (lexer, T_LPAREN))
{
lex_force_num (lexer);
factor.rconverge = lex_number (lexer);
lex_get (lexer);
- lex_force_match (lexer, ')');
+ lex_force_match (lexer, T_RPAREN);
}
}
else if (lex_match_id (lexer, "ITERATE"))
{
- if ( lex_force_match (lexer, '('))
+ if ( lex_force_match (lexer, T_LPAREN))
{
lex_force_int (lexer);
factor.iterations = lex_integer (lexer);
lex_get (lexer);
- lex_force_match (lexer, ')');
+ lex_force_match (lexer, T_RPAREN);
}
}
else if (lex_match_id (lexer, "DEFAULT"))
else if (lex_match_id (lexer, "EXTRACTION"))
{
extraction_seen = true;
- lex_match (lexer, '=');
- while (lex_token (lexer) != '.' && lex_token (lexer) != '/')
+ lex_match (lexer, T_EQUALS);
+ while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
{
if (lex_match_id (lexer, "PAF"))
{
}
else if (lex_match_id (lexer, "FORMAT"))
{
- lex_match (lexer, '=');
- while (lex_token (lexer) != '.' && lex_token (lexer) != '/')
+ lex_match (lexer, T_EQUALS);
+ while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
{
if (lex_match_id (lexer, "SORT"))
{
}
else if (lex_match_id (lexer, "BLANK"))
{
- if ( lex_force_match (lexer, '('))
+ if ( lex_force_match (lexer, T_LPAREN))
{
lex_force_num (lexer);
factor.blank = lex_number (lexer);
lex_get (lexer);
- lex_force_match (lexer, ')');
+ lex_force_match (lexer, T_RPAREN);
}
}
else if (lex_match_id (lexer, "DEFAULT"))
else if (lex_match_id (lexer, "PRINT"))
{
factor.print = 0;
- lex_match (lexer, '=');
- while (lex_token (lexer) != '.' && lex_token (lexer) != '/')
+ lex_match (lexer, T_EQUALS);
+ while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
{
if (lex_match_id (lexer, "UNIVARIATE"))
{
}
else if (lex_match_id (lexer, "MISSING"))
{
- lex_match (lexer, '=');
- while (lex_token (lexer) != '.' && lex_token (lexer) != '/')
+ lex_match (lexer, T_EQUALS);
+ while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
{
if (lex_match_id (lexer, "INCLUDE"))
{
if (factor->print & PRINT_SIG)
{
const double y = heading_rows + y_pos_sig * factor->n_vars;
- tab_text (t, 0, y, TAT_TITLE, _("Sig. 1-tailed"));
+ tab_text (t, 0, y, TAT_TITLE, _("Sig. (1-tailed)"));
for (i = 0; i < factor->n_vars; ++i)
{
idata->cov = covariance_calculate (cov);
+ if (idata->cov == NULL)
+ {
+ msg (MW, _("The dataset contains no complete observations. No analysis will be performed."));
+ goto finish;
+ }
+
var_matrix = covariance_moments (cov, MOMENT_VARIANCE);
mean_matrix = covariance_moments (cov, MOMENT_MEAN);
idata->n = covariance_moments (cov, MOMENT_NONE);