dnl PSPP - a program for statistical analysis.
dnl Copyright (C) 2017 Free Software Foundation, Inc.
-dnl
+dnl
dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
-dnl
+dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
-dnl
+dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
dnl
[data list free /v1 v2.
begin data.
0 1
-2 3
+2 3
4 5
3 4
end data.
[data list free /v1 v2.
begin data.
0 1
-2 3
+2 3
4 5
3 4
end data.
weight by w.
-frequencies /x
- /format=notable
+frequencies /x
+ /format=notable
/statistics=none
/histogram=minimum(0) maximum(50) percent(5) normal.
])
# Cannot use the CSV driver for this because it does not output charts
# at all.
-AT_CHECK([pspp -O format=pdf frequencies.sps], [0], [ignore])
+AT_CHECK([pspp -O format=pdf frequencies.sps], [0], [ignore], [ignore])
AT_CLEANUP
# Tests for a bug which crashed PSPP when the median and a histogram
m4_define([FREQUENCIES_NTILES_OUTPUT], [dnl
Table: Statistics
-,,x
-N,Valid,5
-,Missing,0
-Mean,,3.00
-Std Dev,,1.58
-Minimum,,1.00
-Maximum,,5.00
-Percentiles,0,1.00
-,25,2.00
-,33,2.33
-,50,3.00
-,67,3.67
-,75,4.00
-,100,5.00
+,,x,y
+N,Valid,5,5
+,Missing,0,0
+Mean,,3.00,30.00
+Std Dev,,1.58,15.81
+Minimum,,1.00,10.00
+Maximum,,5.00,50.00
+Percentiles,0,1.00,10.00
+,25,2.00,20.00
+,33,2.33,23.33
+,50,3.00,30.00
+,67,3.67,36.67
+,75,4.00,40.00
+,100,5.00,50.00
])
AT_SETUP([FREQUENCIES basic percentiles])
AT_DATA([frequencies.sps],
- [DATA LIST LIST notable /x * .
+ [DATA LIST LIST notable /x y.
BEGIN DATA.
-1
-2
-3
-4
-5
+1 10
+2 20
+3 30
+4 40
+5 50
END DATA.
-FREQUENCIES
- VAR=x
+FREQUENCIES
+ VAR=x y
/FORMAT=NOTABLE
/PERCENTILES = 0 25 33.333 50 66.666 75 100.
])
AT_SETUP([FREQUENCIES basic n-tiles])
AT_DATA([frequencies.sps],
- [DATA LIST LIST notable /x * .
+ [DATA LIST LIST notable /x y.
BEGIN DATA.
-1
-2
-3
-4
-5
+1 10
+2 20
+3 30
+4 40
+5 50
END DATA.
-FREQUENCIES
- VAR=x
+FREQUENCIES
+ VAR=x y
/FORMAT=NOTABLE
/NTILES = 3
/NTILES = 4.
AT_DATA([frequencies.sps],
[DATA LIST LIST notable /X * .
BEGIN DATA.
-1
-2
-3
-4
+1
+2
+3
+4
5
END DATA.
-FREQUENCIES
+FREQUENCIES
VAR=x
/ALGORITHM=COMPATIBLE
/PERCENTILES = 0 25 50 75 100.
AT_DATA([frequencies.sps],
[DATA LIST LIST notable /X * .
BEGIN DATA.
-1
-2
-3
-4
+1
+2
+3
+4
5
END DATA.
-FREQUENCIES
+FREQUENCIES
VAR=x
/PERCENTILES = 0 25 50 75 100.
])
WEIGHT BY f.
-FREQUENCIES
+FREQUENCIES
VAR=x
/PERCENTILES = 0 25 50 75 100.
])
WEIGHT BY f.
-FREQUENCIES
+FREQUENCIES
VAR=x
/PERCENTILES = 0 25 50 75 100.
])
WEIGHT BY f.
-FREQUENCIES
+FREQUENCIES
VAR=x
/PERCENTILES = 0 25 50 75 100.
])
MISSING VALUE x (99.0) .
WEIGHT BY f.
-FREQUENCIES
+FREQUENCIES
VAR=x
/PERCENTILES = 0 25 50 75 100.
])
AT_DATA([frequencies.sps], [dnl
data list notable list /d4 *.
begin data.
-0
-0
-0
-1
-0
-0
-0
-0
-1
-0
-0
-0
-0
-0
-1
-2
-0
+0
+0
+0
+1
+0
+0
+0
+0
+1
+0
+0
+0
+0
+0
+1
+2
+0
end data.
FREQUENCIES
Sum,,. @&t@
Table: x
-,,Frequency,Percent,Valid Percent,Cumulative Percent
-Missing,. ,3,100.0%,,
-Total,,3,.0%,,
+,,Frequency,Percent
+Missing,. ,3,100.0%
+Total,,3,.0%
])
AT_CLEANUP
AT_CHECK([pspp bug.sps], [0], [ignore])
AT_CLEANUP
+
+
+AT_SETUP([FREQUENCIES vs. missing weights])
+AT_DATA([warn.sps], [dnl
+data list notable list /x w .
+begin data.
+1 1
+2 1
+1 1
+3 1
+3 .
+4 .
+end data.
+
+weight by w.
+
+frequencies /variables=x.
+])
+
+AT_CHECK([pspp warn.sps -O format=csv], [0], [dnl
+"warn.sps:13: warning: FREQUENCIES: At least one case in the data file had a weight value that was user-missing, system-missing, zero, or negative. These case(s) were ignored."
+
+Table: Statistics
+,,x
+N,Valid,4.00
+,Missing,.00
+Mean,,1.75
+Std Dev,,.96
+Minimum,,1.00
+Maximum,,4.00
+
+Table: x
+,,Frequency,Percent,Valid Percent,Cumulative Percent
+Valid,1.00,2.00,50.0%,50.0%,50.0%
+,2.00,1.00,25.0%,25.0%,75.0%
+,3.00,1.00,25.0%,25.0%,100.0%
+,4.00,.00,.0%,.0%,100.0%
+Total,,4.00,100.0%,,
+])
+
+AT_CLEANUP