AT_BANNER([MEANS procedure])

AT_SETUP([MEANS simple example])

AT_DATA([means-simple.sps], [dnl
SET FORMAT=F12.5.

data list notable list /score * factor *.
BEGIN DATA.
22 01
22 01
29 01
16 01
24 02
21 02
22 01
24 01
19 01
17 01
22 01
17 02
23 02
25 02
20 01
15 01
18 01
26 01
23 02
35 02
20 01
16 01
19 01
14 01
14 01
21 01
END DATA.

MEANS TABLES = score BY factor.
])

AT_CHECK([pspp -O format=csv means-simple.sps], [0],
  [dnl
Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
score: factor,26,100%,0,0%,26,100%
score: ,26,100%,0,0%,26,100%

Table: Report
,factor,Mean,N,Std. Deviation
score,1.00000,19.78947,19.00000,4.03566
,2.00000,24.00000,7.00000,5.50757

Table: Report
,Mean,N,Std. Deviation
score,20.92308,26.00000,4.75750
])

AT_CLEANUP



AT_SETUP([MEANS very simple example])

AT_DATA([means-vsimple.sps], [dnl
SET FORMAT=F12.5.

data list notable list /score.
begin data.
1
1
2
2
end data.

means tables = score.
])

AT_CHECK([pspp -O format=csv means-vsimple.sps], [0],
  [dnl
Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
score: ,4,100%,0,0%,4,100%

Table: Report
,Mean,N,Std. Deviation
score,1.50000,4.00000,.57735
])

AT_CLEANUP




AT_SETUP([MEANS default missing])

AT_DATA([means-dmiss.sps], [dnl
SET FORMAT=F12.2.
data list notable list /a * g1 * g2 *.
begin data.
3 1 . 
4 1 11
3 1 21
6 2 21
2 2 31
. 2 31
8 2 31
7 2 31
end data.

MEANS TABLES = 
      a BY g1 g2
      BY g2
      /cells = MEAN COUNT
      .
])

AT_CHECK([pspp -O format=csv means-dmiss.sps], [0],
  [dnl
Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
a: g1 * g2,6,75%,2,25%,8,100%
a: g2,6,75%,2,25%,8,100%
a: ,7,87.5%,1,12.5%,8,100%

Table: Report
,g1,g2,Mean,N
a,1.00,11.00,4.00,1.00
,1.00,21.00,3.00,1.00
,2.00,21.00,6.00,1.00
,2.00,31.00,5.67,3.00

Table: Report
,g2,Mean,N
a,11.00,4.00,1.00
,21.00,4.50,2.00
,31.00,5.67,3.00

Table: Report
,Mean,N
a,5.00,6.00
])

AT_CLEANUP


AT_SETUP([MEANS linear stats])

dnl Slightly more involved example to test the linear statistics
AT_DATA([means-linear.sps], [dnl
set format F12.4.
data list notable list /id * group * test1 *
begin data.
1 1 85
2 1 90
3 1 82
4 1 75
5 1 99
6 2 70
7 2 66
8 2 52
9 2 71
10 2 50
end data.

add value labels /group 1 "experimental group" 2 "control group".

means test1 by group
  /cells = mean count stddev sum min max range variance kurt skew
  .
])


AT_CHECK([pspp -O format=csv means-linear.sps], [0],
  [dnl
Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
test1: group,10,100%,0,0%,10,100%
test1: ,10,100%,0,0%,10,100%

Table: Report
,group,Mean,N,Std. Deviation,Sum,Min,Max,Range,Variance,Kurtosis,Skewness
test1,experimental group,86.2000,5.0000,8.9833,431.0000,75.0000,99.0000,24.0000,80.7000,.2727,.3858
,control group,61.8000,5.0000,10.0598,309.0000,50.0000,71.0000,21.0000,101.2000,-3.0437,-.4830

Table: Report
,Mean,N,Std. Deviation,Sum,Min,Max,Range,Variance,Kurtosis,Skewness
test1,74.0000,10.0000,15.6915,740.0000,50.0000,99.0000,49.0000,246.2222,-.5759,-.1262
])

AT_CLEANUP


AT_SETUP([MEANS standard errors])

AT_DATA([means-stderr.sps], [dnl
set format F12.4.
data list notable list /id * group * test1 *
begin data.
1 1 85
2 1 90
3 1 82
4 1 75
5 1 99
6 1 70
7 2 66
8 2 52
9 2 71
10 2 50
end data.

means test1 by group 
	/cells = mean count semean seskew sekurt.
])


AT_CHECK([pspp -O format=csv means-stderr.sps], [0],
  [dnl
Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
test1: group,10,100%,0,0%,10,100%
test1: ,10,100%,0,0%,10,100%

Table: Report
,group,Mean,N,S.E. Mean,S.E. Skew,S.E. Kurt
test1,1.0000,83.5000,6.0000,4.2485,.8452,1.7408
,2.0000,59.7500,4.0000,5.1700,1.0142,2.6186

Table: Report
,Mean,N,S.E. Mean,S.E. Skew,S.E. Kurt
test1,74.0000,10.0000,4.9621,.6870,1.3342
])

AT_CLEANUP



AT_SETUP([MEANS harmonic and geometric means])

AT_DATA([means-hg.sps], [dnl
set format F12.4.
data list notable list /x * y *.
begin data.
1 3
2 3
3 3
4 3
5 3
end data.


means x y
	/cells = mean harmonic geometric
.
])


AT_CHECK([pspp -O format=csv means-hg.sps], [0],
  [dnl
Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
x: ,5,100%,0,0%,5,100%
y: ,5,100%,0,0%,5,100%

Table: Report
,Mean,Harmonic Mean,Geom. Mean
x,3.0000,2.1898,2.6052
y,3.0000,3.0000,3.0000
])

AT_CLEANUP






AT_SETUP([MEANS all/none/default])

dnl Make sure that /CELLS = {ALL,NONE,DEFAULT} work properly
AT_DATA([means-stat-keywords.sps], [dnl
SET FORMAT=F12.2.
SET DECIMAL=DOT.

DATA LIST NOTABLE LIST /score *.
BEGIN DATA.
22
22
29
16
23
END DATA.

MEANS score /CELLS = ALL.
MEANS score /CELLS = DEFAULT.
MEANS score /CELLS = NONE.
])


AT_CHECK([pspp -O format=csv means-stat-keywords.sps], [0],
  [dnl
Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
score: ,5,100%,0,0%,5,100%

Table: Report
,Mean,N,Std. Deviation,S.E. Mean,Sum,Min,Max,Range,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,First,Last,Harmonic Mean,Geom. Mean
score,22.40,5.00,4.62,2.06,112.00,16.00,29.00,13.00,21.30,1.85,2.00,.11,.91,22.00,23.00,21.61,22.01

Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
score: ,5,100%,0,0%,5,100%

Table: Report
,Mean,N,Std. Deviation
score,22.40,5.00,4.62

Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
score: ,5,100%,0,0%,5,100%

Table: Report

score
])

AT_CLEANUP




AT_SETUP([MEANS missing=table ])

AT_DATA([means-miss-table.sps], [dnl
data list notable list /a * b * g1.
begin data.
1 9 1  
2 9 1 
3 9 1 
4 9 2 
5 9 2 
6 9 2 
7 . 2 
end data.

MEANS a b BY g1
      /a  BY g1
      /cells =  COUNT
      /missing = TABLE
      .

MEANS a b BY g1
      /a  BY g1
      /cells =  COUNT
      .
])


AT_CHECK([pspp -O format=csv means-miss-table.sps], [0],
  [dnl
Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
a: g1,7,100%,0,0%,7,100%
a: ,7,100%,0,0%,7,100%
b: g1,6,85.7143%,1,14.2857%,7,100%
b: ,6,85.7143%,1,14.2857%,7,100%

Table: Report
,g1,N
a,1.00,3.00
,2.00,3.00
b,1.00,3.00
,2.00,3.00

Table: Report
,N
a,6.00
b,6.00

Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
a: g1,7,100%,0,0%,7,100%
a: ,7,100%,0,0%,7,100%

Table: Report
,g1,N
a,1.00,3.00
,2.00,4.00

Table: Report
,N
a,7.00

Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
a: g1,7,100%,0,0%,7,100%
a: ,7,100%,0,0%,7,100%
b: g1,6,85.7143%,1,14.2857%,7,100%
b: ,6,85.7143%,1,14.2857%,7,100%

Table: Report
,g1,N
a,1.00,3.00
,2.00,4.00
b,1.00,3.00
,2.00,3.00

Table: Report
,N
a,7.00
b,6.00

Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
a: g1,7,100%,0,0%,7,100%
a: ,7,100%,0,0%,7,100%

Table: Report
,g1,N
a,1.00,3.00
,2.00,4.00

Table: Report
,N
a,7.00
])

AT_CLEANUP





AT_SETUP([MEANS user missing values])

AT_DATA([means-missing.sps], [dnl
data list notable list /a * b * g1.
begin data.
1 2 9  
2 2 1 
3 2 1 
4 2 2 
5 2 2 
6 2 2 
7 9 2 
end data.

MISSING VALUES a b g1 (9).

MEANS a b BY g1 /cells =  COUNT .

MEANS a b BY g1 /cells =  COUNT /missing = include .

MEANS a b BY g1 /cells =  COUNT /missing = dependent .
])


AT_CHECK([pspp -O format=csv means-missing.sps], [0],
  [dnl
Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
a: g1,6,85.7143%,1,14.2857%,7,100%
a: ,7,100%,0,0%,7,100%
b: g1,5,71.4286%,2,28.5714%,7,100%
b: ,6,85.7143%,1,14.2857%,7,100%

Table: Report
,g1,N
a,1.00,2.00
,2.00,4.00
b,1.00,2.00
,2.00,3.00

Table: Report
,N
a,6.00
b,5.00

Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
a: g1,7,100%,0,0%,7,100%
a: ,7,100%,0,0%,7,100%
b: g1,7,100%,0,0%,7,100%
b: ,7,100%,0,0%,7,100%

Table: Report
,g1,N
a,1.00,2.00
,2.00,4.00
,9.00,1.00
b,1.00,2.00
,2.00,4.00
,9.00,1.00

Table: Report
,N
a,7.00
b,7.00

Table: Case Processing Summary
,Cases,,,,,
,Included,,Excluded,,Total,
,N,Percent,N,Percent,N,Percent
a: g1,7,100%,0,0%,7,100%
a: ,7,100%,0,0%,7,100%
b: g1,6,85.7143%,1,14.2857%,7,100%
b: ,6,85.7143%,1,14.2857%,7,100%

Table: Report
,g1,N
a,1.00,2.00
,2.00,4.00
,9.00,1.00
b,1.00,2.00
,2.00,3.00
,9.00,1.00

Table: Report
,N
a,7.00
b,6.00
])

AT_CLEANUP



