projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update to latest Gnulib
[pspp]
/
src
/
language
/
stats
/
oneway.c
diff --git
a/src/language/stats/oneway.c
b/src/language/stats/oneway.c
index d08e3114c04d8155d6fe035000ba42745f05dc07..aa8a255211192852f78318940d68179e046ec28c 100644
(file)
--- a/
src/language/stats/oneway.c
+++ b/
src/language/stats/oneway.c
@@
-360,14
+360,14
@@
updateit (void *user_data,
const union value *valx = case_data (c, varp);
const union value *valx = case_data (c, varp);
+ struct descriptive_data *dd_total = aux2;
+
+ double weight;
+
if ( var_is_value_missing (varp, valx, exclude))
return;
if ( var_is_value_missing (varp, valx, exclude))
return;
- struct descriptive_data *dd_total = aux2;
-
- double weight = 1.0;
- if (wv)
- weight = case_data (c, wv)->f;
+ weight = wv != NULL ? case_data (c, wv)->f : 1.0;
moments1_add (dd->mom, valx->f, weight);
if (valx->f * weight < dd->minimum)
moments1_add (dd->mom, valx->f, weight);
if (valx->f * weight < dd->minimum)
@@
-469,8
+469,12
@@
run_oneway (const struct oneway_spec *cmd,
for (i = 0; i < cmd->n_vars; ++i)
{
for (i = 0; i < cmd->n_vars; ++i)
{
+ struct per_var_ws *pvw = &ws.vws[i];
const struct variable *v = cmd->vars[i];
const union value *val = case_data (c, v);
const struct variable *v = cmd->vars[i];
const union value *val = case_data (c, v);
+ struct group_proc *gp = group_proc_get (cmd->vars[i]);
+ struct hsh_table *group_hash = gp->group_hash;
+ struct group_statistics *gs;
if ( MISS_ANALYSIS == cmd->missing_type)
{
if ( MISS_ANALYSIS == cmd->missing_type)
{
@@
-478,16
+482,7
@@
run_oneway (const struct oneway_spec *cmd,
continue;
}
continue;
}
- {
- struct per_var_ws *pvw = &ws.vws[i];
-
- covariance_accumulate_pass1 (pvw->cov, c);
- }
-
- struct group_proc *gp = group_proc_get (cmd->vars[i]);
- struct hsh_table *group_hash = gp->group_hash;
-
- struct group_statistics *gs;
+ covariance_accumulate_pass1 (pvw->cov, c);
gs = hsh_find (group_hash, indep_val );
gs = hsh_find (group_hash, indep_val );
@@
-764,14
+759,16
@@
show_anova_table (const struct oneway_spec *cmd, const struct oneway_workspace *
for (i = 0; i < cmd->n_vars; ++i)
{
double n;
for (i = 0; i < cmd->n_vars; ++i)
{
double n;
- moments1_calculate (ws->dd_total[i]->mom, &n, NULL, NULL, NULL, NULL);
-
+ double df1, df2;
+ double msa;
+ const char *s = var_to_string (cmd->vars[i]);
const struct per_var_ws *pvw = &ws->vws[i];
const struct per_var_ws *pvw = &ws->vws[i];
- const double df1 = pvw->n_groups - 1;
- const double df2 = n - pvw->n_groups;
- const double msa = pvw->ssa / df1;
- const char *s = var_to_string (cmd->vars[i]);
+ moments1_calculate (ws->dd_total[i]->mom, &n, NULL, NULL, NULL, NULL);
+
+ df1 = pvw->n_groups - 1;
+ df2 = n - pvw->n_groups;
+ msa = pvw->ssa / df1;
tab_text (t, 0, i * 3 + 1, TAB_LEFT | TAT_TITLE, s);
tab_text (t, 1, i * 3 + 1, TAB_LEFT | TAT_TITLE, _("Between Groups"));
tab_text (t, 0, i * 3 + 1, TAB_LEFT | TAT_TITLE, s);
tab_text (t, 1, i * 3 + 1, TAB_LEFT | TAT_TITLE, _("Between Groups"));
@@
-1008,21
+1005,22
@@
show_homogeneity (const struct oneway_spec *cmd, const struct oneway_workspace *
for (v = 0; v < cmd->n_vars; ++v)
{
double n;
for (v = 0; v < cmd->n_vars; ++v)
{
double n;
- moments1_calculate (ws->dd_total[v]->mom, &n, NULL, NULL, NULL, NULL);
+
const struct per_var_ws *pvw = &ws->vws[v];
const struct per_var_ws *pvw = &ws->vws[v];
- const struct categoricals *cats = covariance_get_categoricals (pvw->cov);
const struct variable *var = cmd->vars[v];
const struct group_proc *gp = group_proc_get (cmd->vars[v]);
const char *s = var_to_string (var);
const struct variable *var = cmd->vars[v];
const struct group_proc *gp = group_proc_get (cmd->vars[v]);
const char *s = var_to_string (var);
-
- const double df1 = pvw->n_groups - 1;
- const double df2 = n - pvw->n_groups;
+ double df1, df2;
double F = gp->levene;
double F = gp->levene;
- tab_text (t, 0, v + 1, TAB_LEFT | TAT_TITLE, s);
+ moments1_calculate (ws->dd_total[v]->mom, &n, NULL, NULL, NULL, NULL);
+
+ df1 = pvw->n_groups - 1;
+ df2 = n - pvw->n_groups;
+ tab_text (t, 0, v + 1, TAB_LEFT | TAT_TITLE, s);
tab_double (t, 1, v + 1, TAB_RIGHT, F, NULL);
tab_fixed (t, 2, v + 1, TAB_RIGHT, df1, 8, 0);
tab_double (t, 1, v + 1, TAB_RIGHT, F, NULL);
tab_fixed (t, 2, v + 1, TAB_RIGHT, df1, 8, 0);
@@
-1239,13
+1237,13
@@
show_contrast_tests (const struct oneway_spec *cmd, const struct oneway_workspac
{
double n, mean, variance;
const struct descriptive_data *dd = categoricals_get_user_data_by_subscript (cats, ci);
{
double n, mean, variance;
const struct descriptive_data *dd = categoricals_get_user_data_by_subscript (cats, ci);
-
- moments1_calculate (dd->mom, &n, &mean, &variance, NULL, NULL);
-
struct coeff_node *cn = ll_data (coeffi, struct coeff_node, ll);
const double coef = cn->coeff;
struct coeff_node *cn = ll_data (coeffi, struct coeff_node, ll);
const double coef = cn->coeff;
+ double winv ;
+
+ moments1_calculate (dd->mom, &n, &mean, &variance, NULL, NULL);
-
const double
winv = variance / n;
+ winv = variance / n;
contrast_value += coef * mean;
contrast_value += coef * mean;