Add copyright and licence notices to files which lack them.
[pspp] / tests / language / stats / reliability.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl 
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl 
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 dnl AT_BANNER([RELIABILITY])
17
18 AT_SETUP([RELIABILITY])
19 AT_DATA([reliability.sps], [dnl
20 data list notable list  /var1 *
21         var2  *
22         var6  *
23         var7  *
24         var8  *
25         var9  *
26         var11 *
27         var12 *
28         var15 *
29         var16 *
30         var17 *
31         var19 *
32         .
33
34 begin data.
35 6 7 7 5 7 7 7 7 7 7 6 6
36 6 7 7 6 7 6 7 5 6 5 7 7
37 6 6 7 6 5 3 6 4 5 6 4 5
38 4 6 5 6 6 5 4 3 5 6 5 6
39 5 6 5 5 6 5 4 4 6 6 5 5
40 6 6 7 6 6 5 6 5 6 6 5 6
41 5 6 6 5 6 5 5 4 6 5 5 5
42 5 7 7 7 7 7 6 5 7 7 7 7
43 6 6 6 5 5 7 6 5 6 6 5 6
44 . . . . . . . . . . . .
45 6 6 5 5 5 6 6 4 6 5 5 5
46 7 7 7 6 7 6 7 6 6 6 7 6
47 4 7 6 6 6 5 5 4 4 5 5 6
48 5 6 3 5 4 1 4 6 2 3 3 2
49 3 6 6 5 6 2 4 2 2 4 4 5
50 6 6 7 5 6 5 7 6 5 6 6 5
51 6 5 6 6 5 6 6 6 6 4 5 5
52 5 7 7 . 6 6 6 5 6 6 6 6
53 5 7 5 5 4 6 7 6 5 4 6 5
54 7 7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 6 7 5 6
135 5 7 6 6 6 6 6 5 6 7 7 6
136 7 7 5 6 7 7 7 7 6 5 7 7
137 6 7 6 6 5 6 7 7 6 5 6 6
138 6 7 7 7 7 6 6 7 6 7 7 7
139 4 6 4 7 3 6 5 5 4 3 5 6
140 5 5 7 5 4 6 7 5 4 6 6 5
141 5 5 6 4 6 5 7 6 5 5 5 6
142 . . . . . . . . . . . .
143 . . . . . . . . . . . .
144 5 7 7 5 6 6 7 7 6 6 6 7
145 6 7 7 1 2 1 7 7 5 5 5 2
146 . . . . . . . . . . . .
147 3 7 4 6 4 7 4 6 4 7 4 7
148 5 7 3 5 5 6 7 5 4 7 7 4
149 4 7 7 5 4 6 7 7 6 5 4 4
150 6 6 2 2 6 4 6 5 5 1 5 2
151 5 5 6 4 5 4 6 5 5 6 5 5
152 . . . . . . . . . . . .
153 5 7 6 6 6 6 6 6 5 6 6 6
154 6 6 6 5 6 6 6 6 7 5 6 7
155 3 6 3 3 5 3 3 5 3 5 7 4
156 4 4 6 3 3 3 4 3 4 2 3 6
157 5 7 7 6 5 4 7 5 7 7 3 7
158 4 5 4 4 4 4 3 3 3 4 3 3
159 6 7 7 5 6 6 7 5 4 5 5 5
160 3 5 3 3 1 3 4 3 4 7 6 7
161 4 5 4 4 4 3 4 5 6 6 4 5
162 5 6 3 4 5 3 5 3 4 5 6 4
163 5 5 5 6 6 6 6 4 5 6 6 5
164 6 7 7 2 2 6 7 7 7 7 5 7
165 5 7 7 4 6 5 7 5 5 5 6 6
166 6 6 7 7 5 5 5 7 6 7 7 7
167 6 5 7 3 6 5 6 5 5 6 5 4
168 5 7 6 5 6 6 6 5 6 5 5 6
169 4 5 5 5 6 3 5 3 3 6 5 5
170 . . . . . . . . . . . .
171 5 6 6 4 4 4 5 3 5 5 2 6
172 5 6 7 5 5 6 6 5 5 6 6 6
173 6 7 7 6 4 7 7 6 7 5 6 7
174 6 6 5 4 5 2 7 6 6 5 6 6
175 2 2 2 2 2 2 3 2 3 1 1 2
176 end data.
177
178 RELIABILITY
179   /VARIABLES=var2 var8 var15 var17 var6
180   /SCALE('Everything') var6 var8 var15 var17
181   /MODEL=ALPHA.
182
183 RELIABILITY
184   /VARIABLES=var6 var8 var15 var17
185   /SCALE('Nothing') ALL
186   /MODEL=SPLIT(2)
187  .
188
189 RELIABILITY
190   /VARIABLES=var2 var6 var8 var15 var17 var19
191   /SCALE('Totals') var6 var8 var15 var17 
192   /SUMMARY = total
193   /STATISTICS = DESCRIPTIVES COVARIANCES
194  .
195
196
197 RELIABILITY
198   /VARIABLES=var6 var8 var15 var17 
199   .
200 ])
201 AT_CHECK([pspp -o pspp.csv reliability.sps], [0],
202   [reliability.sps:174: warning: RELIABILITY: The STATISTICS subcommand is not yet implemented.  No statistics will be produced.
203 ])
204 AT_CHECK([cat pspp.csv], [0], [dnl
205 Scale: Everything
206
207 Table: Case Processing Summary
208 ,,N,%
209 Cases,Valid,131,92.91
210 ,Excluded,10,7.09
211 ,Total,141,100.00
212
213 Table: Reliability Statistics
214 Cronbach's Alpha,N of Items
215 .75,4
216
217 Scale: Nothing
218
219 Table: Case Processing Summary
220 ,,N,%
221 Cases,Valid,131,92.91
222 ,Excluded,10,7.09
223 ,Total,141,100.00
224
225 Table: Reliability Statistics
226 Cronbach's Alpha,Part 1,Value,.55
227 ,,N of Items,2
228 ,Part 2,Value,.63
229 ,,N of Items,2
230 ,Total N of Items,,4
231 Correlation Between Forms,,,.61
232 Spearman-Brown Coefficient,Equal Length,,.75
233 ,Unequal Length,,.75
234 Guttman Split-Half Coefficient,,,.75
235
236 reliability.sps:174: warning: RELIABILITY: The STATISTICS subcommand is not yet implemented.  No statistics will be produced.
237
238 Scale: Totals
239
240 Table: Case Processing Summary
241 ,,N,%
242 Cases,Valid,131,92.91
243 ,Excluded,10,7.09
244 ,Total,141,100.00
245
246 Table: Reliability Statistics
247 Cronbach's Alpha,N of Items
248 .75,4
249
250 Table: Item-Total Statistics
251 ,Scale Mean if Item Deleted,Scale Variance if Item Deleted,Corrected Item-Total Correlation,Cronbach's Alpha if Item Deleted
252 var6,15.97,8.43,.51,.71
253 var8,16.56,7.86,.53,.70
254 var15,16.47,8.45,.56,.68
255 var17,16.60,8.00,.57,.67
256
257 Scale: ANY
258
259 Table: Case Processing Summary
260 ,,N,%
261 Cases,Valid,131,92.91
262 ,Excluded,10,7.09
263 ,Total,141,100.00
264
265 Table: Reliability Statistics
266 Cronbach's Alpha,N of Items
267 .75,4
268 ])
269 AT_CLEANUP
270
271
272 dnl This was causing a AT.  
273 AT_SETUP([RELIABILITY bad syntax])
274 AT_DATA([bad-syntax.sps], [dnl
275 data list notable list /x * y *.
276 begin data.
277 1 10
278 2 20
279 3 30
280 4 50
281 5 50
282 end data.
283
284 * This syntax is incorrect
285 reliability x y.
286 ])
287
288 AT_CHECK([pspp -O format=csv bad-syntax.sps], [1], [ignore])
289
290 AT_CLEANUP
291
292 dnl Checks for a crash when bad syntax followed scale specification.
293 AT_SETUP([RELIABILITY bad syntax 2])
294 AT_DATA([bad-syntax.sps], [dnl
295 new file.
296 data list notable list /f01 f02 f03 f04 f05 f06 f07 f08 f09 f10 *.
297 begin data.
298 end data.
299
300 * This syntax is incorrect
301 reliability variables=f01 to f10/asdfj.
302 ])
303 AT_CHECK([pspp -O format=csv bad-syntax.sps], [1], [ignore])
304 AT_CLEANUP
305
306
307 dnl Checks for a crash when the active file was empty.  Bug #38660.
308 AT_SETUP([RELIABILITY crash with no data])
309 AT_DATA([reliability.sps], [dnl
310 new file.
311 data list notable list /f01 f02 f03 f04 f05 f06 f07 f08 f09 f10 *.
312 begin data.
313 end data.
314
315 reliability variables=f01 to f10.
316 ])
317 AT_CHECK([pspp -O format=csv reliability.sps], [0], [])
318 AT_CLEANUP
319
320
321
322
323 dnl This is an example from doc/tutorial.texi
324 dnl So if the results of this have to be changed in any way,
325 dnl make sure to update that file.
326 AT_SETUP([RELIABILITY tutorial example])
327 AT_DATA([tut-example.sps], [dnl
328 get file='hotel.sav'.
329
330 compute v3 = 6 - v3.
331 compute v5 = 6 - v5.
332
333 reliability variables = v1 v3 v4.
334 ])
335
336 AT_CHECK([ln -s $top_srcdir/examples/hotel.sav .], [0])
337 AT_CHECK([pspp -O format=csv tut-example.sps], [0], [dnl 
338 Scale: ANY
339
340 Table: Case Processing Summary
341 ,,N,%
342 Cases,Valid,17,100.00
343 ,Excluded,0,.00
344 ,Total,17,100.00
345
346 Table: Reliability Statistics
347 Cronbach's Alpha,N of Items
348 .81,3
349 ])
350
351 AT_CLEANUP