a50150555ccbf32e1ac79692b5a7f494589cde27
[pspp-builds.git] / tests / language / stats / glm.at
1 AT_BANNER([GLM procedure])
2
3 AT_SETUP([GLM latin square design])
4
5 dnl This example comes from :
6 dnl  http://ssnds.uwo.ca/statsexamples/spssanova/latinsquareresults.html
7 AT_DATA([latin.sps], [dnl
8 set format = F20.3.
9 data list notable  fixed /a 1 b 3 c 5 y 7-10(2).
10 begin data.
11 1 1 6  3.5
12 1 2 2  8.9
13 1 3 3  9.6
14 1 4 4 10.5
15 1 5 5  3.1
16 1 6 1  5.9
17 2 1 2  4.2
18 2 2 6  1.9
19 2 3 5  3.7
20 2 4 3 10.2
21 2 5 1  7.2
22 2 6 4  7.6
23 3 1 1  6.7
24 3 2 4  5.8
25 3 3 6 -2.7
26 3 4 2  4.6
27 3 5 3  4.0
28 3 6 5 -0.7
29 4 1 4  6.6
30 4 2 1  4.5
31 4 3 2  3.7
32 4 4 5  3.7
33 4 5 6 -3.3
34 4 6 3  3.0
35 5 1 3  4.1
36 5 2 5  2.4
37 5 3 4  6.0
38 5 4 1  5.1
39 5 5 2  3.5
40 5 6 6  4.0
41 6 1 5  3.8
42 6 2 3  5.8
43 6 3 1  7.0
44 6 4 6  3.8
45 6 5 4  5.0
46 6 6 2  8.6
47 end data.
48
49 variable labels a 'Factor A' b 'Factor B' c 'Factor C' y 'Criterion'.
50
51 glm y by   b a c
52   /intercept=include
53   /criteria=alpha(.05)
54   /design = a b c
55   .
56 ])
57
58 AT_CHECK([pspp -O format=csv latin.sps | sed 's/329.62[[678]]/329.62/'], [0],
59   [dnl
60 warning: GLM is experimental.  Do not rely on these results.
61
62 Table: Tests of Between-Subjects Effects
63 Source,Type III Sum of Squares,df,Mean Square,F,Sig.
64 Corrected Model,263.064,15,17.538,5.269,.000
65 Intercept,815.103,1,815.103,244.910,.000
66 Factor A,78.869,5,15.774,4.739,.005
67 Factor B,28.599,5,5.720,1.719,.176
68 Factor C,155.596,5,31.119,9.350,.000
69 Error,66.563,20,3.328,,
70 Total,1144.730,36,,,
71 Corrected Total,329.62,35,,,
72 ])
73
74 AT_CLEANUP
75
76 AT_SETUP([GLM 2 by 2 factorial design])
77
78 AT_DATA([2by2.sps], [dnl
79 set format = F20.3.
80 data list notable  list /Factor0 * Factor1 * points (F10).
81 begin data.
82 1       4       332
83 1       4       380
84 1       4       371
85 1       4       366
86 1       4       354
87 1       0       259.5
88 1       0       302.5
89 1       0       296
90 1       0       349
91 1       0       309
92 2       4       354.67
93 2       4       353.5
94 2       4       304
95 2       4       365
96 2       4       339
97 2       0       306
98 2       0       339
99 2       0       353
100 2       0       351
101 2       0       333
102 end data.
103
104 glm points by Factor0 Factor1
105   /intercept=include
106   /criteria=alpha(.05)
107   .
108 ])
109
110
111 AT_CHECK([pspp -O format=csv 2by2.sps ], [0],
112   [dnl
113 warning: GLM is experimental.  Do not rely on these results.
114
115 Table: Tests of Between-Subjects Effects
116 Source,Type III Sum of Squares,df,Mean Square,F,Sig.
117 Corrected Model,8667.053,3,2889.018,5.043,.012
118 Intercept,2256018.640,1,2256018.640,3937.693,.000
119 Factor0,313.394,1,313.394,.547,.470
120 Factor1,5157.508,1,5157.508,9.002,.008
121 Factor0 * Factor1,3196.150,1,3196.150,5.579,.031
122 Error,9166.865,16,572.929,,
123 Total,2273852.559,20,,,
124 Corrected Total,17833.918,19,,,
125 ])
126
127 AT_CLEANUP
128
129
130 AT_SETUP([GLM Type 1 Sums of Squares])
131
132 dnl  The following example comes from 
133 dnl  http://www.uvm.edu/~dhowell/StatPages/More_Stuff/Type1-3.pdf
134 AT_DATA([type1.sps], [dnl
135 set decimal = dot.
136 set format=F20.3.
137 data list notable list /dv * Agrp * B0 * B1 * B2 * i0 * i1 * i2 * sss *.
138 begin data.
139 5 1 1 0 0 1 0 0 1.00
140 7 1 1 0 0 1 0 0 1.00
141 9 1 1 0 0 1 0 0 1.00
142 8 1 1 0 0 1 0 0 1.00
143 2 1 0 1 0 0 1 0 1.00
144 5 1 0 1 0 0 1 0 1.00
145 7 1 0 1 0 0 1 0 1.00
146 3 1 0 1 0 0 1 0 1.00
147 9 1 0 1 0 0 1 0 1.00
148 8 1 0 0 1 0 0 1 1.00
149 11 1 0 0 1 0 0 1 1.00
150 12 1 0 0 1 0 0 1 1.00
151 14 1 0 0 1 0 0 1 1.00
152 11 1 -1 -1 -1 -1 -1 -1 1.00
153 15 1 -1 -1 -1 -1 -1 -1 1.00
154 16 1 -1 -1 -1 -1 -1 -1 1.00
155 10 1 -1 -1 -1 -1 -1 -1 1.00
156 9 1 -1 -1 -1 -1 -1 -1 1.00
157 7 -1 1 0 0 -1 0 0 2.00
158 9 -1 1 0 0 -1 0 0 2.00
159 10 -1 1 0 0 -1 0 0 2.00
160 9 -1 1 0 0 -1 0 0 2.00
161 3 -1 0 1 0 0 -1 0 2.00
162 8 -1 0 1 0 0 -1 0 2.00
163 9 -1 0 1 0 0 -1 0 2.00
164 11 -1 0 1 0 0 -1 0 2.00
165 9 -1 0 0 1 0 0 -1 2.00
166 12 -1 0 0 1 0 0 -1 2.00
167 14 -1 0 0 1 0 0 -1 2.00
168 8 -1 0 0 1 0 0 -1 2.00
169 7 -1 0 0 1 0 0 -1 2.00
170 11 -1 -1 -1 -1 1 1 1 2.00
171 14 -1 -1 -1 -1 1 1 1 2.00
172 10 -1 -1 -1 -1 1 1 1 2.00
173 12 -1 -1 -1 -1 1 1 1 2.00
174 13 -1 -1 -1 -1 1 1 1 2.00
175 11 -1 -1 -1 -1 1 1 1 2.00
176 12 -1 -1 -1 -1 1 1 1 2.00
177 end data.
178
179 do if B0 = -1 AND B1 = -1 AND B2 = -1.
180 compute Bgrp = 4.
181 end if.
182
183 do if B0 = 0 AND B1 = 0 AND B2 = 1.
184 compute Bgrp = 3.
185 end if.
186
187 do if B0 = 0 AND B1 = 1 AND B2 = 0.
188 compute Bgrp = 2.
189 end if.
190
191 do if B0 = 1 AND B1 = 0 AND B2 = 0.
192 compute Bgrp = 1.
193 end if.
194
195
196 glm dv by Agrp Bgrp
197         /method = sstype (1)
198         .
199
200 glm dv by Agrp Bgrp
201         /method = sstype (1)
202         /design Bgrp Agrp Bgrp * Agrp
203         .
204 ])
205
206
207 AT_CHECK([pspp -O format=csv type1.sps], [0],
208   [dnl
209 warning: GLM is experimental.  Do not rely on these results.
210
211 Table: Tests of Between-Subjects Effects
212 Source,Type I Sum of Squares,df,Mean Square,F,Sig.
213 Corrected Model,216.017,7,30.860,5.046,.001
214 Intercept,3410.526,1,3410.526,557.709,.000
215 Agrp,9.579,1,9.579,1.566,.220
216 Bgrp,186.225,3,62.075,10.151,.000
217 Agrp * Bgrp,20.212,3,6.737,1.102,.364
218 Error,183.457,30,6.115,,
219 Total,3810.000,38,,,
220 Corrected Total,399.474,37,,,
221
222 warning: GLM is experimental.  Do not rely on these results.
223
224 Table: Tests of Between-Subjects Effects
225 Source,Type I Sum of Squares,df,Mean Square,F,Sig.
226 Corrected Model,216.017,7,30.860,5.046,.001
227 Intercept,3410.526,1,3410.526,557.709,.000
228 Bgrp,193.251,3,64.417,10.534,.000
229 Agrp,2.553,1,2.553,.418,.523
230 Bgrp * Agrp,20.212,3,6.737,1.102,.364
231 Error,183.457,30,6.115,,
232 Total,3810.000,38,,,
233 Corrected Total,399.474,37,,,
234 ])
235
236 AT_CLEANUP