Added Boxplots to the EXAMINE subcommand repertoire
[pspp-builds.git] / tests / command / examine-percentiles.sh
1 #!/bin/sh
2
3 # This program tests  the PERCENTILES subcommand of the EXAMINE command.
4 # In particular it tests that it behaves properly when there are only 
5 # a few cases
6
7 TEMPDIR=/tmp/pspp-tst-$$
8
9 here=`pwd`;
10
11 # ensure that top_srcdir is absolute
12 cd $top_srcdir; top_srcdir=`pwd`
13
14 export STAT_CONFIG_PATH=$top_srcdir/config
15
16
17 cleanup()
18 {
19      rm -rf $TEMPDIR
20 }
21
22
23 fail()
24 {
25     echo $activity
26     echo FAILED
27     cleanup;
28     exit 1;
29 }
30
31
32 no_result()
33 {
34     echo $activity
35     echo NO RESULT;
36     cleanup;
37     exit 2;
38 }
39
40 pass()
41 {
42     cleanup;
43     exit 0;
44 }
45
46 mkdir -p $TEMPDIR
47
48 cd $TEMPDIR
49
50 activity="create program"
51 cat > $TEMPDIR/out.stat <<EOF
52 DATA LIST LIST /x *.
53 BEGIN DATA.
54 2.00 
55 8.00 
56 5.00 
57 END DATA.
58
59 EXAMINE /x
60         /PERCENTILES=HAVERAGE.
61
62 EXAMINE /x
63         /PERCENTILES=WAVERAGE.
64
65 EXAMINE /x
66         /PERCENTILES=ROUND.
67
68 EXAMINE /x
69         /PERCENTILES=EMPIRICAL.
70
71 EXAMINE /x
72         /PERCENTILES=AEMPIRICAL.
73 EOF
74 if [ $? -ne 0 ] ; then no_result ; fi
75
76 activity="run program"
77 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
78 if [ $? -ne 0 ] ; then no_result ; fi
79
80
81 activity="compare results"
82 diff $TEMPDIR/pspp.list - << EOF
83 1.1 DATA LIST.  Reading free-form data from the command file.
84 +--------+------+
85 |Variable|Format|
86 #========#======#
87 |X       |F8.0  |
88 +--------+------+
89
90 2.1 EXAMINE.  Case Processing Summary
91 #=#=============================#
92 # #            Cases            #
93 # #---------+---------+---------#
94 # #  Valid  | Missing |  Total  #
95 # #-+-------+-+-------+-+-------#
96 # #N|Percent|N|Percent|N|Percent#
97 #=#=#=======#=#=======#=#=======#
98 #X#3|   100%|0|     0%|3|   100%#
99 #=#=#=======#=#=======#=#=======#
100
101 2.2 EXAMINE.  Percentiles
102 #================#================================#
103 #                #             Percentiles        #
104 #                #---+---+----+----+----+----+----#
105 #                # 5 | 10| 25 | 50 | 75 | 90 | 95 #
106 #=#==============#===#===#====#====#====#====#====#
107 #X|HAverage      #.40|.80|2.00|5.00|8.00|8.00|8.00#
108 # |Tukey's Hinges#   |   |3.50|5.00|6.50|    |    #
109 #=#==============#===#===#====#====#====#====#====#
110
111 3.1 EXAMINE.  Case Processing Summary
112 #=#=============================#
113 # #            Cases            #
114 # #---------+---------+---------#
115 # #  Valid  | Missing |  Total  #
116 # #-+-------+-+-------+-+-------#
117 # #N|Percent|N|Percent|N|Percent#
118 #=#=#=======#=#=======#=#=======#
119 #X#3|   100%|0|     0%|3|   100%#
120 #=#=#=======#=#=======#=#=======#
121
122 3.2 EXAMINE.  Percentiles
123 #==================#================================#
124 #                  #             Percentiles        #
125 #                  #---+---+----+----+----+----+----#
126 #                  # 5 | 10| 25 | 50 | 75 | 90 | 95 #
127 #=#================#===#===#====#====#====#====#====#
128 #X|Weighted Average#.30|.60|1.50|3.50|5.75|7.10|7.55#
129 # |Tukey's Hinges  #   |   |3.50|5.00|6.50|    |    #
130 #=#================#===#===#====#====#====#====#====#
131
132 4.1 EXAMINE.  Case Processing Summary
133 #=#=============================#
134 # #            Cases            #
135 # #---------+---------+---------#
136 # #  Valid  | Missing |  Total  #
137 # #-+-------+-+-------+-+-------#
138 # #N|Percent|N|Percent|N|Percent#
139 #=#=#=======#=#=======#=#=======#
140 #X#3|   100%|0|     0%|3|   100%#
141 #=#=#=======#=#=======#=#=======#
142
143 4.2 EXAMINE.  Percentiles
144 #================#================================#
145 #                #             Percentiles        #
146 #                #---+---+----+----+----+----+----#
147 #                # 5 | 10| 25 | 50 | 75 | 90 | 95 #
148 #=#==============#===#===#====#====#====#====#====#
149 #X|Rounded       #.00|.00|2.00|5.00|5.00|8.00|8.00#
150 # |Tukey's Hinges#   |   |3.50|5.00|6.50|    |    #
151 #=#==============#===#===#====#====#====#====#====#
152
153 5.1 EXAMINE.  Case Processing Summary
154 #=#=============================#
155 # #            Cases            #
156 # #---------+---------+---------#
157 # #  Valid  | Missing |  Total  #
158 # #-+-------+-+-------+-+-------#
159 # #N|Percent|N|Percent|N|Percent#
160 #=#=#=======#=#=======#=#=======#
161 #X#3|   100%|0|     0%|3|   100%#
162 #=#=#=======#=#=======#=#=======#
163
164 5.2 EXAMINE.  Percentiles
165 #================#==================================#
166 #                #              Percentiles         #
167 #                #----+----+----+----+----+----+----#
168 #                #  5 | 10 | 25 | 50 | 75 | 90 | 95 #
169 #=#==============#====#====#====#====#====#====#====#
170 #X|Empirical     #2.00|2.00|2.00|5.00|8.00|8.00|8.00#
171 # |Tukey's Hinges#    |    |3.50|5.00|6.50|    |    #
172 #=#==============#====#====#====#====#====#====#====#
173
174 6.1 EXAMINE.  Case Processing Summary
175 #=#=============================#
176 # #            Cases            #
177 # #---------+---------+---------#
178 # #  Valid  | Missing |  Total  #
179 # #-+-------+-+-------+-+-------#
180 # #N|Percent|N|Percent|N|Percent#
181 #=#=#=======#=#=======#=#=======#
182 #X#3|   100%|0|     0%|3|   100%#
183 #=#=#=======#=#=======#=#=======#
184
185 6.2 EXAMINE.  Percentiles
186 #==========================#==================================#
187 #                          #              Percentiles         #
188 #                          #----+----+----+----+----+----+----#
189 #                          #  5 | 10 | 25 | 50 | 75 | 90 | 95 #
190 #=#========================#====#====#====#====#====#====#====#
191 #X|Empirical with averaging#2.00|2.00|2.00|5.00|8.00|8.00|8.00#
192 # |Tukey's Hinges          #    |    |3.50|5.00|6.50|    |    #
193 #=#========================#====#====#====#====#====#====#====#
194
195 EOF
196 if [ $? -ne 0 ] ; then fail ; fi
197
198 pass