13f7c888106f168752789b31ba22fdc61350255a
[pspp] / tests / command / examine.sh
1 #!/bin/sh
2
3 # This program tests  the EXAMINE command.
4
5 TEMPDIR=/tmp/pspp-tst-$$
6
7 here=`pwd`;
8
9 # ensure that top_srcdir is absolute
10 cd $top_srcdir; top_srcdir=`pwd`
11
12 export STAT_CONFIG_PATH=$top_srcdir/config
13
14
15 cleanup()
16 {
17      rm -rf $TEMPDIR
18 }
19
20
21 fail()
22 {
23     echo $activity
24     echo FAILED
25     cleanup;
26     exit 1;
27 }
28
29
30 no_result()
31 {
32     echo $activity
33     echo NO RESULT;
34     cleanup;
35     exit 2;
36 }
37
38 pass()
39 {
40     cleanup;
41     exit 0;
42 }
43
44 mkdir -p $TEMPDIR
45
46 cd $TEMPDIR
47
48 activity="create program"
49 cat > $TEMPDIR/out.stat <<EOF
50 DATA LIST LIST /quality * w * brand * .
51 BEGIN DATA
52 3  1  1
53 2  2  1
54 1  2  1
55 1  1  1
56 4  1  1
57 4  1  1
58 5  1  2
59 2  1  2
60 4  4  2
61 2  1  2
62 3  1  2
63 7  1  3
64 4  2  3
65 5  3  3
66 3  1  3
67 6  1  3
68 END DATA
69
70 WEIGHT BY w.
71
72 VARIABLE LABELS brand   'Manufacturer'.
73 VARIABLE LABELS quality 'Breaking Strain'.
74
75 VALUE LABELS /brand 1 'Aspeger' 2 'Bloggs' 3 'Charlies'.
76
77 LIST /FORMAT=NUMBERED.
78
79 EXAMINE
80         quality BY brand
81         /STATISTICS descriptives extreme(3)
82         .
83 EOF
84 if [ $? -ne 0 ] ; then no_result ; fi
85
86
87 activity="run program"
88 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
89 if [ $? -ne 0 ] ; then no_result ; fi
90
91 # NOTE:  In the following data: Only the extreme values have been checked
92 # The descriptives have been blindly pasted.
93 activity="compare results"
94 diff $TEMPDIR/pspp.list - << EOF
95 1.1 DATA LIST.  Reading free-form data from the command file.
96 +--------+------+
97 |Variable|Format|
98 #========#======#
99 |QUALITY |F8.0  |
100 |W       |F8.0  |
101 |BRAND   |F8.0  |
102 +--------+------+
103
104 Case#  QUALITY        W    BRAND
105 ----- -------- -------- --------
106     1     3.00     1.00     1.00 
107     2     2.00     2.00     1.00 
108     3     1.00     2.00     1.00 
109     4     1.00     1.00     1.00 
110     5     4.00     1.00     1.00 
111     6     4.00     1.00     1.00 
112     7     5.00     1.00     2.00 
113     8     2.00     1.00     2.00 
114     9     4.00     4.00     2.00 
115    10     2.00     1.00     2.00 
116    11     3.00     1.00     2.00 
117    12     7.00     1.00     3.00 
118    13     4.00     2.00     3.00 
119    14     5.00     3.00     3.00 
120    15     3.00     1.00     3.00 
121    16     6.00     1.00     3.00 
122
123 2.1 EXAMINE.  Case Processing Summary
124 #===============#===============================#
125 #               #             Cases             #
126 #               #----------+---------+----------#
127 #               #   Valid  | Missing |   Total  #
128 #               #--+-------+-+-------+--+-------#
129 #               # N|Percent|N|Percent| N|Percent#
130 #===============#==#=======#=#=======#==#=======#
131 #Breaking Strain#24|   100%|0|     0%|24|   100%#
132 #===============#==#=======#=#=======#==#=======#
133
134 2.2 EXAMINE.  Extreme Values
135 #=======================#===========#=====#
136 #                       #Case Number|Value#
137 #=======================#===========#=====#
138 #Breaking StrainHighest1#         12| 7.00#
139 #                      2#         16| 6.00#
140 #                      3#         14| 5.00#
141 #               --------#-----------+-----#
142 #                Lowest1#          4| 1.00#
143 #                      2#          3| 1.00#
144 #                      3#          3| 1.00#
145 #=======================#===========#=====#
146
147 2.3 EXAMINE.  Descriptives
148 #==========================================================#=========#==========#
149 #                                                          #Statistic|Std. Error#
150 #==========================================================#=========#==========#
151 #Breaking StrainMean                                       #   3.54  |   .324   #
152 #               95% Confidence Interval for MeanLower Bound#  3.562  |          #
153 #                                               Upper Bound#  3.521  |          #
154 #               5% Trimmed Mean                            #   3.50  |          #
155 #               Median                                     #         |          #
156 #               Variance                                   #  2.520  |          #
157 #               Std. Deviation                             #  1.587  |          #
158 #               Minimum                                    #  1.000  |          #
159 #               Maximum                                    #  7.000  |          #
160 #               Range                                      #  6.000  |          #
161 #               Interquartile Range                        #         |          #
162 #               Skewness                                   #         |          #
163 #               Kurtosis                                   #         |          #
164 #==========================================================#=========#==========#
165
166 2.4 EXAMINE.  Case Processing Summary
167 #===========================#=============================#
168 #                           #            Cases            #
169 #                           #---------+---------+---------#
170 #                           #  Valid  | Missing |  Total  #
171 #                           #-+-------+-+-------+-+-------#
172 #               Manufacturer#N|Percent|N|Percent|N|Percent#
173 #===========================#=#=======#=#=======#=#=======#
174 #Breaking StrainAspeger     #8|   100%|0|     0%|8|   100%#
175 #               Bloggs      #8|   100%|0|     0%|8|   100%#
176 #               Charlies    #8|   100%|0|     0%|8|   100%#
177 #===========================#=#=======#=#=======#=#=======#
178
179 2.5 EXAMINE.  Extreme Values
180 #===================================#===========#=====#
181 #               Manufacturer        #Case Number|Value#
182 #===================================#===========#=====#
183 #Breaking StrainAspeger     Highest1#          6| 4.00#
184 #                                  2#          5| 4.00#
185 #                                  3#          1| 3.00#
186 #                           --------#-----------+-----#
187 #                            Lowest1#          4| 1.00#
188 #                                  2#          3| 1.00#
189 #                                  3#          3| 1.00#
190 #               --------------------#-----------+-----#
191 #               Bloggs      Highest1#          7| 5.00#
192 #                                  2#          9| 4.00#
193 #                                  3#          9| 4.00#
194 #                           --------#-----------+-----#
195 #                            Lowest1#         10| 2.00#
196 #                                  2#          8| 2.00#
197 #                                  3#         11| 3.00#
198 #               --------------------#-----------+-----#
199 #               Charlies    Highest1#         12| 7.00#
200 #                                  2#         16| 6.00#
201 #                                  3#         14| 5.00#
202 #                           --------#-----------+-----#
203 #                            Lowest1#         15| 3.00#
204 #                                  2#         13| 4.00#
205 #                                  3#         13| 4.00#
206 #===================================#===========#=====#
207
208 2.6 EXAMINE.  Descriptives
209 #======================================================================#=========#==========#
210 #               Manufacturer                                           #Statistic|Std. Error#
211 #======================================================================#=========#==========#
212 #Breaking StrainAspeger     Mean                                       #   2.25  |   .453   #
213 #                           95% Confidence Interval for MeanLower Bound#  2.279  |          #
214 #                                                           Upper Bound#  2.221  |          #
215 #                           5% Trimmed Mean                            #   2.22  |          #
216 #                           Median                                     #         |          #
217 #                           Variance                                   #  1.643  |          #
218 #                           Std. Deviation                             #  1.282  |          #
219 #                           Minimum                                    #  1.000  |          #
220 #                           Maximum                                    #  4.000  |          #
221 #                           Range                                      #  3.000  |          #
222 #                           Interquartile Range                        #         |          #
223 #                           Skewness                                   #         |          #
224 #                           Kurtosis                                   #         |          #
225 #               -------------------------------------------------------#---------+----------#
226 #               Bloggs      Mean                                       #   3.50  |   .378   #
227 #                           95% Confidence Interval for MeanLower Bound#  3.525  |          #
228 #                                                           Upper Bound#  3.475  |          #
229 #                           5% Trimmed Mean                            #   3.50  |          #
230 #                           Median                                     #         |          #
231 #                           Variance                                   #  1.143  |          #
232 #                           Std. Deviation                             #  1.069  |          #
233 #                           Minimum                                    #  2.000  |          #
234 #                           Maximum                                    #  5.000  |          #
235 #                           Range                                      #  3.000  |          #
236 #                           Interquartile Range                        #         |          #
237 #                           Skewness                                   #         |          #
238 #                           Kurtosis                                   #         |          #
239 #               -------------------------------------------------------#---------+----------#
240 #               Charlies    Mean                                       #   4.88  |   .441   #
241 #                           95% Confidence Interval for MeanLower Bound#  4.904  |          #
242 #                                                           Upper Bound#  4.846  |          #
243 #                           5% Trimmed Mean                            #   4.86  |          #
244 #                           Median                                     #         |          #
245 #                           Variance                                   #  1.554  |          #
246 #                           Std. Deviation                             #  1.246  |          #
247 #                           Minimum                                    #  3.000  |          #
248 #                           Maximum                                    #  7.000  |          #
249 #                           Range                                      #  4.000  |          #
250 #                           Interquartile Range                        #         |          #
251 #                           Skewness                                   #         |          #
252 #                           Kurtosis                                   #         |          #
253 #======================================================================#=========#==========#
254
255 EOF
256 if [ $? -ne 0 ] ; then fail ; fi
257
258 pass