Checkin of new directory structure.
[pspp-builds.git] / tests / command / oneway-with-splits.sh
1 #!/bin/sh
2
3 # This program tests that the ONEWAY anova command works OK
4 # when SPLIT FILE is active
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 # ensure that top_builddir  are absolute
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
12 top_builddir=`cd $top_builddir; pwd`
13
14 # ensure that top_srcdir is absolute
15 top_srcdir=`cd $top_srcdir; pwd`
16
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
19
20
21 cleanup()
22 {
23     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
24         echo Not cleaning $TEMPDIR;
25         return ; 
26     fi
27     cd /
28     rm -rf $TEMPDIR
29 }
30
31
32 fail()
33 {
34     echo $activity
35     echo FAILED
36     cleanup;
37     exit 1;
38 }
39
40
41 no_result()
42 {
43     echo $activity
44     echo NO RESULT;
45     cleanup;
46     exit 2;
47 }
48
49 pass()
50 {
51     cleanup;
52     exit 0;
53 }
54
55 mkdir -p $TEMPDIR
56
57 cd $TEMPDIR
58
59 activity="create program"
60 cat > $TESTFILE <<EOF
61 DATA LIST LIST /QUALITY * BRAND * S *.
62 BEGIN DATA
63 3 1 1
64 2 1 1
65 1 1 1
66 1 1 1
67 4 1 1
68 5 2 1
69 2 2 1
70 4 2 2
71 2 2 2
72 3 2 2
73 7  3 2
74 4  3 2
75 5  3 2
76 3  3 2
77 6  3 2
78 END DATA
79
80 VARIABLE LABELS brand 'Manufacturer'.
81 VARIABLE LABELS quality 'Breaking Strain'.
82
83 VALUE LABELS /brand 1 'Aspeger' 2 'Bloggs' 3 'Charlies'.
84
85 SPLIT FILE by s.
86
87 ONEWAY
88         quality BY brand
89         /STATISTICS descriptives homogeneity
90         /CONTRAST =  -2 2
91         /CONTRAST = -1 1
92         .
93 EOF
94 if [ $? -ne 0 ] ; then no_result ; fi
95
96
97 activity="run program"
98 $SUPERVISOR $top_builddir/src/pspp -o raw-ascii $TESTFILE
99 if [ $? -ne 0 ] ; then no_result ; fi
100
101 perl -pi -e s/^\s*\$//g $TEMPDIR/pspp.list
102 diff -b  $TEMPDIR/pspp.list - << EOF | perl -e 's/^\s*$//g'
103 1.1 DATA LIST.  Reading free-form data from INLINE.
104 +--------+------+
105 |Variable|Format|
106 #========#======#
107 |QUALITY |F8.0  |
108 |BRAND   |F8.0  |
109 |S       |F8.0  |
110 +--------+------+
111
112 Variable Value    Label
113 S            1.00
114
115 2.1 ONEWAY.  Descriptives
116 #===============#=======#=#====#==============#==========#=======================#=======#=======#
117 #               |       # |    |              |          |    95% Confidence     |       |       #
118 #               |       # |    |              |          +-----------+-----------+       |       #
119 #               |       #N|Mean|Std. Deviation|Std. Error|Lower Bound|Upper Bound|Minimum|Maximum#
120 #===============#=======#=#====#==============#==========#===========#===========#=======#=======#
121 #Breaking Strain|Aspeger#5|2.20|          1.30|       .58|        .58|       3.82|   1.00|   4.00#
122 #               |Bloggs #2|3.50|          2.12|      1.50|     -15.56|      22.56|   2.00|   5.00#
123 #               |Total  #7|2.57|          1.51|       .57|       1.17|       3.97|   1.00|   5.00#
124 #===============#=======#=#====#==============#==========#===========#===========#=======#=======#
125
126 2.2 ONEWAY.  Test of Homogeneity of Variances
127 #===============#================#===#===#============#
128 #               #Levene Statistic|df1|df2|Significance#
129 #===============#================#===#===#============#
130 #Breaking Strain#           1.086|  1|  5|        .345#
131 #===============#================#===#===#============#
132
133 2.3 ONEWAY.  ANOVA
134 #==============================#==============#==#===========#=====#============#
135 #                              #Sum of Squares|df|Mean Square|  F  |Significance#
136 #===============#==============#==============#==#===========#=====#============#
137 #Breaking Strain|Between Groups#          2.41| 1|      2.414|1.068|        .349#
138 #               |Within Groups #         11.30| 5|      2.260|     |            #
139 #               |Total         #         13.71| 6|           |     |            #
140 #===============#==============#==============#==#===========#=====#============#
141
142 2.4 ONEWAY.  Contrast Coefficients
143 #==========#==============#
144 #          # Manufacturer #
145 #          #-------+------#
146 #          #Aspeger|Bloggs#
147 #========#=#=======#======#
148 #Contrast|1#     -2|     2#
149 #        |2#     -1|     1#
150 #========#=#=======#======#
151
152 2.5 ONEWAY.  Contrast Tests
153 #===============================================#=================#==========#=====#=====#===============#
154 #                                       Contrast#Value of Contrast|Std. Error|  t  |  df |Sig. (2-tailed)#
155 #===============#======================#========#=================#==========#=====#=====#===============#
156 #Breaking Strain|Assume equal variances|    1   #             2.60|     2.516|1.034|    5|           .349#
157 #               |                      |    2   #             1.30|     1.258|1.034|    5|           .349#
158 #               |Does not assume equal |    1   #             2.60|     3.219| .808|1.318|           .539#
159 #               |                      |    2   #             1.30|     1.609| .808|1.318|           .539#
160 #===============#======================#========#=================#==========#=====#=====#===============#
161
162 Variable Value    Label
163 S            2.00
164
165 2.6 ONEWAY.  Descriptives
166 #===============#========#=#====#==============#==========#=======================#=======#=======#
167 #               |        # |    |              |          |    95% Confidence     |       |       #
168 #               |        # |    |              |          +-----------+-----------+       |       #
169 #               |        #N|Mean|Std. Deviation|Std. Error|Lower Bound|Upper Bound|Minimum|Maximum#
170 #===============#========#=#====#==============#==========#===========#===========#=======#=======#
171 #Breaking Strain|Bloggs  #3|3.00|          1.00|       .58|        .52|       5.48|   2.00|   4.00#
172 #               |Charlies#5|5.00|          1.58|       .71|       3.04|       6.96|   3.00|   7.00#
173 #               |Total   #8|4.25|          1.67|       .59|       2.85|       5.65|   2.00|   7.00#
174 #===============#========#=#====#==============#==========#===========#===========#=======#=======#
175
176 2.7 ONEWAY.  Test of Homogeneity of Variances
177 #===============#================#===#===#============#
178 #               #Levene Statistic|df1|df2|Significance#
179 #===============#================#===#===#============#
180 #Breaking Strain#            .923|  1|  6|        .374#
181 #===============#================#===#===#============#
182
183 2.8 ONEWAY.  ANOVA
184 #==============================#==============#==#===========#=====#============#
185 #                              #Sum of Squares|df|Mean Square|  F  |Significance#
186 #===============#==============#==============#==#===========#=====#============#
187 #Breaking Strain|Between Groups#          7.50| 1|      7.500|3.750|        .101#
188 #               |Within Groups #         12.00| 6|      2.000|     |            #
189 #               |Total         #         19.50| 7|           |     |            #
190 #===============#==============#==============#==#===========#=====#============#
191
192 2.9 ONEWAY.  Contrast Coefficients
193 #==========#===============#
194 #          #  Manufacturer #
195 #          #------+--------#
196 #          #Bloggs|Charlies#
197 #========#=#======#========#
198 #Contrast|1#    -2|       2#
199 #        |2#    -1|       1#
200 #========#=#======#========#
201
202 2.10 ONEWAY.  Contrast Tests
203 #===============================================#=================#==========#=====#=====#===============#
204 #                                       Contrast#Value of Contrast|Std. Error|  t  |  df |Sig. (2-tailed)#
205 #===============#======================#========#=================#==========#=====#=====#===============#
206 #Breaking Strain|Assume equal variances|    1   #             4.00|     2.066|1.936|    6|           .101#
207 #               |                      |    2   #             2.00|     1.033|1.936|    6|           .101#
208 #               |Does not assume equal |    1   #             4.00|     1.826|2.191|5.882|           .072#
209 #               |                      |    2   #             2.00|      .913|2.191|5.882|           .072#
210 #===============#======================#========#=================#==========#=====#=====#===============#
211
212 EOF
213 if [ $? -ne 0 ] ; then fail ; fi
214
215 pass