weight = wv != NULL ? case_data (c, wv)->f : 1.0;
moments1_add (dd->mom, valx->f, weight);
- if (valx->f * weight < dd->minimum)
- dd->minimum = valx->f * weight;
+ if (valx->f < dd->minimum)
+ dd->minimum = valx->f;
- if (valx->f * weight > dd->maximum)
- dd->maximum = valx->f * weight;
+ if (valx->f > dd->maximum)
+ dd->maximum = valx->f;
{
const struct variable *var = dd_total->var;
val->f,
weight);
- if (val->f * weight < dd_total->minimum)
- dd_total->minimum = val->f * weight;
+ if (val->f < dd_total->minimum)
+ dd_total->minimum = val->f;
- if (val->f * weight > dd_total->maximum)
- dd_total->maximum = val->f * weight;
+ if (val->f > dd_total->maximum)
+ dd_total->maximum = val->f;
}
}
totals->sum += weight * val->f;
totals->ssq += weight * pow2 (val->f);
- if ( val->f * weight < totals->minimum )
- totals->minimum = val->f * weight;
+ if ( val->f < totals->minimum )
+ totals->minimum = val->f;
- if ( val->f * weight > totals->maximum )
- totals->maximum = val->f * weight;
+ if ( val->f > totals->maximum )
+ totals->maximum = val->f;
gs->n += weight;
gs->sum += weight * val->f;
gs->ssq += weight * pow2 (val->f);
- if ( val->f * weight < gs->minimum )
- gs->minimum = val->f * weight;
+ if ( val->f < gs->minimum )
+ gs->minimum = val->f;
- if ( val->f * weight > gs->maximum )
- gs->maximum = val->f * weight;
+ if ( val->f > gs->maximum )
+ gs->maximum = val->f;
}
gp->n_groups = hsh_count (group_hash );
/* Now fill in the numbers ... */
- tab_fixed (t, 2, row + count, 0, n, 8, 0);
+ tab_double (t, 2, row + count, 0, n, wfmt);
tab_double (t, 3, row + count, 0, mean, NULL);
BEGIN DATA
7 3
4 3
-3 1
-2 1
-1 1
-4 2
-2 2
-3 2
+3 1
+2 1
+1 1
+4 2
+2 2
+3 2
5 3
-1 1
-4 1
-5 2
-2 2
+1 1
+4 1
+5 2
+2 2
3 3
6 3
END DATA
])
AT_CLEANUP
+
+
+
+dnl Tests that everything treats weights properly
+AT_SETUP([ONEWAY vs. weights])
+
+AT_DATA([oneway-unweighted.sps],
+[DATA LIST NOTABLE LIST /QUALITY * BRAND * W *.
+BEGIN DATA
+3 1 1
+2 1 1
+1 1 1
+1 1 1
+4 1 1
+5 2 1
+2 2 1
+4 2 1
+4 2 1
+4 2 1
+2 2 1
+2 2 1
+3 2 1
+7 3 1
+4 3 1
+5 3 1
+5 3 1
+3 3 1
+6 3 1
+END DATA.
+
+WEIGHT BY W.
+
+ONEWAY
+ quality BY brand
+ /STATISTICS descriptives homogeneity
+ .
+])
+
+AT_CHECK([pspp -o pspp-unweighted.csv oneway-unweighted.sps], [0], [ignore], [ignore])
+
+AT_DATA([oneway-weighted.sps],
+[DATA LIST NOTABLE LIST /QUALITY * BRAND * W *.
+BEGIN DATA
+3 1 1
+2 1 1
+1 1 2
+4 1 1
+5 2 1
+2 2 1
+4 2 3
+2 2 2
+3 2 1
+7 3 1
+4 3 1
+5 3 2
+3 3 1
+6 3 1
+END DATA.
+
+WEIGHT BY W.
+
+ONEWAY
+ quality BY brand
+ /STATISTICS descriptives homogeneity
+ .
+])
+
+AT_CHECK([pspp -o pspp-weighted.csv oneway-weighted.sps], [0], [ignore], [ignore])
+
+
+AT_CHECK([diff pspp-weighted.csv pspp-unweighted.csv], [0])
+
+
+AT_CLEANUP