Sat Oct 30 09:16:29 WST 2004 John Darrington <john@darrington.wattle.id.au>
+ * oneway.q Fixed up the behaviour when given missing values
+
* levene.c oneway.q Fixed a buglet with the levene statistic and
incorporated the levene test into the oneway command.
static void show_contrast_tests(void);
-enum stat_table_t {STAT_DESC, STAT_HOMO};
+enum stat_table_t {STAT_DESC = 1, STAT_HOMO = 2};
static enum stat_table_t stat_tables ;
(hsh_hash_func *) hash_value,
0,
(void *) indep_var->width );
-
-
-
precalc(cmd);
-
for(r = casefile_get_reader (cf);
casereader_read (r, &c) ;
case_destroy (&c))
dict_get_case_weight(default_dict,&c,&bad_weight_warn);
const union value *indep_val = case_data (&c, indep_var->fv);
+
+ /* Deal with missing values */
+ if ( value_is_missing(indep_val,indep_var) )
+ continue;
+
+ /* Skip the entire case if /MISSING=LISTWISE is set */
+ if ( cmd->miss == ONEWAY_LISTWISE )
+ {
+ for(i = 0; i < n_vars ; ++i)
+ {
+ const struct variable *v = vars[i];
+ const union value *val = case_data (&c, v->fv);
+
+ if (value_is_missing(val,v) )
+ break;
+ }
+ if ( i != n_vars )
+ continue;
+
+ }
+
hsh_insert ( global_group_hash, (void *) indep_val );
-
for ( i = 0 ; i < n_vars ; ++i )
{
const struct variable *v = vars[i];
if ( stat_tables & STAT_HOMO )
- levene(cf, indep_var, n_vars, vars, LEV_LISTWISE, value_is_missing);
+ levene(cf, indep_var, n_vars, vars,
+ (cmd->miss == ONEWAY_LISTWISE) ? LEV_LISTWISE : LEV_ANALYSIS ,
+ value_is_missing);
ostensible_number_of_groups = hsh_count (global_group_hash);
totals->se_mean = totals->std_dev / sqrt(totals->n);
-
-
-
}
}
command/list.sh \
command/loop.sh \
command/oneway.sh \
+ command/oneway-missing.sh \
command/print.sh \
command/sample.sh \
command/sort.sh \
--- /dev/null
+#!/bin/sh
+
+# This program tests that the ONEWAY anova command works OK when there is missing data
+
+TEMPDIR=/tmp/pspp-tst-$$
+
+here=`pwd`;
+
+# ensure that top_srcdir is absolute
+cd $top_srcdir; top_srcdir=`pwd`
+
+export STAT_CONFIG_PATH=$top_srcdir/config
+
+
+cleanup()
+{
+ rm -rf $TEMPDIR
+}
+
+
+fail()
+{
+ echo $activity
+ echo FAILED
+ cleanup;
+ exit 1;
+}
+
+
+no_result()
+{
+ echo $activity
+ echo NO RESULT;
+ cleanup;
+ exit 2;
+}
+
+pass()
+{
+ cleanup;
+ exit 0;
+}
+
+mkdir -p $TEMPDIR
+
+cd $TEMPDIR
+
+activity="create program"
+cat > $TEMPDIR/out.stat <<EOF
+DATA LIST LIST /v1 * v2 * dep * vn *.
+BEGIN DATA
+. . 1 4
+3 3 1 2
+2 2 1 2
+1 1 1 2
+1 1 1 2
+4 4 1 2
+5 5 2 2
+2 2 2 2
+4 4 2 2
+2 2 2 2
+3 3 2 2
+7 7 3 2
+4 4 3 2
+5 5 3 2
+3 3 3 2
+6 6 3 2
+END DATA
+
+ONEWAY
+ v1 v2 BY dep
+ /STATISTICS descriptives homogeneity
+ /MISSING ANALYSIS
+ .
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program"
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="copy output"
+cp $TEMPDIR/pspp.list $TEMPDIR/pspp.list1
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="create program 2"
+cat > $TEMPDIR/out.stat <<EOF
+DATA LIST LIST /v1 * v2 * dep * vn * .
+BEGIN DATA
+4 . 1 2
+3 3 1 2
+2 2 1 2
+1 1 1 2
+1 1 1 2
+4 4 1 2
+5 5 2 2
+2 2 2 2
+4 4 2 2
+2 2 2 2
+3 3 2 2
+7 7 3 2
+4 4 3 2
+5 5 3 2
+3 3 3 2
+6 6 3 2
+END DATA
+
+ONEWAY
+ v1 v2 BY dep
+ /STATISTICS descriptives homogeneity
+ /MISSING LISTWISE
+ .
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="run program 2"
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="compare outputs"
+diff $TEMPDIR/pspp.list $TEMPDIR/pspp.list1
+if [ $? -ne 0 ] ; then fail ; fi
+
+# Now try a missing dependent variable
+# Everything depends upon it, so it should behave as if LISTWISE were set
+activity="create program 3"
+cat > $TEMPDIR/out.stat <<EOF
+DATA LIST LIST /v1 * v2 * dep * vn * .
+BEGIN DATA
+4 2 . 2
+3 3 1 2
+2 2 1 2
+1 1 1 2
+1 1 1 2
+4 4 1 2
+5 5 2 2
+2 2 2 2
+4 4 2 2
+2 2 2 2
+3 3 2 2
+7 7 3 2
+4 4 3 2
+5 5 3 2
+3 3 3 2
+6 6 3 2
+END DATA
+
+ONEWAY
+ v1 v2 BY dep
+ /STATISTICS descriptives homogeneity
+ /MISSING ANALYSIS
+ .
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="run program 3"
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="compare outputs"
+diff $TEMPDIR/pspp.list $TEMPDIR/pspp.list1
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+pass
|BRAND |F8.0 |
+--------+------+
-2.1 ONEWAY. Test of Homogeneity of Variances
+2.1 ONEWAY. Descriptives
+#===============#========#==#====#==============#==========#=======================#=======#=======#
+# | # | | | | 95% Confidence | | #
+# | # | | | +-----------+-----------+ | #
+# | # N|Mean|Std. Deviation|Std. Error|Lower Bound|Upper Bound|Minimum|Maximum#
+#===============#========#==#====#==============#==========#===========#===========#=======#=======#
+#Breaking Strain|Aspeger # 5|2.20| 1.30| .58| .58| 3.82| 1.00| 4.00#
+# |Bloggs # 5|3.20| 1.30| .58| 1.58| 4.82| 2.00| 5.00#
+# |Charlies# 5|5.00| 1.58| .71| 3.04| 6.96| 3.00| 7.00#
+# |Total #15|3.47| 1.77| .46| 2.49| 4.45| 1.00| 7.00#
+#===============#========#==#====#==============#==========#===========#===========#=======#=======#
+
+2.2 ONEWAY. Test of Homogeneity of Variances
#===============#================#===#===#============#
# #Levene Statistic|df1|df2|Significance#
#===============#================#===#===#============#
#Breaking Strain# .092| 2| 12| .913#
#===============#================#===#===#============#
-2.2 ONEWAY. ANOVA
+2.3 ONEWAY. ANOVA
#==============================#==============#==#===========#=====#============#
# #Sum of Squares|df|Mean Square| F |Significance#
#===============#==============#==============#==#===========#=====#============#
# |Total # 43.73|14| | | #
#===============#==============#==============#==#===========#=====#============#
-2.3 ONEWAY. Contrast Coefficients
+2.4 ONEWAY. Contrast Coefficients
#==========#=======================#
# # Manufacturer #
# #-------+------+--------#
# |2# 0| -1| 1#
#========#=#=======#======#========#
-2.4 ONEWAY. Contrast Tests
+2.5 ONEWAY. Contrast Tests
#===============================================#=================#==========#=====#=====#===============#
# Contrast#Value of Contrast|Std. Error| t | df |Sig. (2-tailed)#
#===============#======================#========#=================#==========#=====#=====#===============#