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