glm.alpha = lex_number (lexer);
lex_get (lexer);
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
{
lex_error (lexer, NULL);
goto error;
else if (lex_match_id (lexer, "METHOD"))
{
lex_match (lexer, T_EQUALS);
- if ( !lex_force_match_id (lexer, "SSTYPE"))
+ if (!lex_force_match_id (lexer, "SSTYPE"))
{
lex_error (lexer, NULL);
goto error;
}
- if ( ! lex_force_match (lexer, T_LPAREN))
+ if (! lex_force_match (lexer, T_LPAREN))
{
lex_error (lexer, NULL);
goto error;
}
- if ( ! lex_force_int (lexer))
+ if (!lex_force_int_range (lexer, "SSTYPE", 1, 3))
{
lex_error (lexer, NULL);
goto error;
}
glm.ss_type = lex_integer (lexer);
- if (1 > glm.ss_type || 3 < glm.ss_type )
- {
- msg (ME, _("Only types 1, 2 & 3 sums of squares are currently implemented"));
- goto error;
- }
-
lex_get (lexer);
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
{
lex_error (lexer, NULL);
goto error;
}
}
- if ( ! design )
+ if (! design)
{
design_full (&glm);
}
const gsl_matrix *cm = covariance_calculate_unnormalized (cov);
size_t i;
size_t k;
- bool *model_dropped = xcalloc (covariance_dim (cov), sizeof (*model_dropped));
- bool *submodel_dropped = xcalloc (covariance_dim (cov), sizeof (*submodel_dropped));
+ bool *model_dropped = XCALLOC (covariance_dim (cov), bool);
+ bool *submodel_dropped = XCALLOC (covariance_dim (cov), bool);
const struct categoricals *cats = covariance_get_categoricals (cov);
size_t n_dropped_model = 0;
const struct interaction * x =
categoricals_get_interaction_by_subscript (cats, i - cmd->n_dep_vars);
- if ( x == cmd->interactions [k])
+ if (x == cmd->interactions [k])
{
model_dropped[i] = false;
n_dropped_model--;
gsl_vector_set (ssq, k + 1,
gsl_matrix_get (submodel_cov, 0, 0) - gsl_matrix_get (model_cov, 0, 0)
- );
+ );
gsl_matrix_free (model_cov);
gsl_matrix_free (submodel_cov);
const gsl_matrix *cm = covariance_calculate_unnormalized (cov);
size_t i;
size_t k;
- bool *model_dropped = xcalloc (covariance_dim (cov), sizeof (*model_dropped));
- bool *submodel_dropped = xcalloc (covariance_dim (cov), sizeof (*submodel_dropped));
+ bool *model_dropped = XCALLOC (covariance_dim (cov), bool);
+ bool *submodel_dropped = XCALLOC (covariance_dim (cov), bool);
const struct categoricals *cats = covariance_get_categoricals (cov);
for (k = 0; k < cmd->n_interactions; k++)
n_dropped_submodel++;
submodel_dropped[i] = true;
- if ( cmd->interactions [k]->n_vars < x->n_vars)
+ if (cmd->interactions [k]->n_vars < x->n_vars)
{
assert (n_dropped_model < covariance_dim (cov));
n_dropped_model++;
gsl_vector_set (ssq, k + 1,
gsl_matrix_get (submodel_cov, 0, 0) - gsl_matrix_get (model_cov, 0, 0)
- );
+ );
gsl_matrix_free (model_cov);
gsl_matrix_free (submodel_cov);
const gsl_matrix *cm = covariance_calculate_unnormalized (cov);
size_t i;
size_t k;
- bool *model_dropped = xcalloc (covariance_dim (cov), sizeof (*model_dropped));
- bool *submodel_dropped = xcalloc (covariance_dim (cov), sizeof (*submodel_dropped));
+ bool *model_dropped = XCALLOC (covariance_dim (cov), bool);
+ bool *submodel_dropped = XCALLOC (covariance_dim (cov), bool);
const struct categoricals *cats = covariance_get_categoricals (cov);
double ss0;
model_dropped[i] = false;
- if ( cmd->interactions [k] == x)
+ if (cmd->interactions [k] == x)
{
assert (n_dropped_model < covariance_dim (cov));
n_dropped_model++;
double weight = dict_get_case_weight (dict, c, &warn_bad_weight);
for (v = 0; v < cmd->n_dep_vars; ++v)
- moments_pass_one (ws.totals, case_data (c, cmd->dep_vars[v])->f,
- weight);
+ moments_pass_one (ws.totals, case_num (c, cmd->dep_vars[v]), weight);
covariance_accumulate_pass1 (cov, c);
}
double weight = dict_get_case_weight (dict, c, &warn_bad_weight);
for (v = 0; v < cmd->n_dep_vars; ++v)
- moments_pass_two (ws.totals, case_data (c, cmd->dep_vars[v])->f,
- weight);
+ moments_pass_two (ws.totals, case_num (c, cmd->dep_vars[v]), weight);
covariance_accumulate_pass2 (cov, c);
}
parse_nested_variable (struct lexer *lexer, struct glm_spec *glm)
{
const struct variable *v = NULL;
- if ( ! lex_match_variable (lexer, glm->dict, &v))
+ if (! lex_match_variable (lexer, glm->dict, &v))
return false;
if (lex_match (lexer, T_LPAREN))
{
- if ( ! parse_nested_variable (lexer, glm))
+ if (! parse_nested_variable (lexer, glm))
return false;
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
return false;
}
- lex_error (lexer, "Nested variables are not yet implemented"); return false;
- return true;
+ lex_error (lexer, "Nested variables are not yet implemented");
+ return false;
}
/* A design term is an interaction OR a nested variable */
if (parse_design_interaction (lexer, glm->dict, &iact))
{
/* Interaction parsing successful. Add to list of interactions */
- glm->interactions = xrealloc (glm->interactions, sizeof *glm->interactions * ++glm->n_interactions);
+ glm->interactions = xrealloc (glm->interactions, sizeof (*glm->interactions) * ++glm->n_interactions);
glm->interactions[glm->n_interactions - 1] = iact;
return true;
}
- if ( parse_nested_variable (lexer, glm))
+ if (parse_nested_variable (lexer, glm))
return true;
return false;
if (lex_token (lexer) == T_ENDCMD || lex_token (lexer) == T_SLASH)
return true;
- if ( ! parse_design_term (lexer, glm))
+ if (! parse_design_term (lexer, glm))
return false;
lex_match (lexer, T_COMMA);
return parse_design_spec (lexer, glm);
}
-