Professional Documents
Culture Documents
Note: Before SPSS version 10.1.3, the WEIGHT variable was used to replicate a
case as many times as indicated by the integer portion of the weight value. The
case then had a probability of additional inclusion equal to the fractional portion
of the weight value.
Observed Frequencies bO i g
If (lo, hi) has been selected, every observed value is truncated to an integer and,
if it is in the lo to hi range, it is included in the frequency count for the
corresponding cell. Otherwise, a count of the frequency of occurrence of the
distinct values is obtained.
1
2 NPAR TESTS
F I
G J
G Ei J
EXPi = G k JN
G
G ∑
H i =1
Ei
J
J
K
If there are cells with expected values less than 5, the number of such cells and
the minimum expected value are printed.
If the number of user-supplied expected frequencies is not equal to the number of
cells generated, or if an expected value is less than or equal to zero, the test
terminates with an error message.
∑
k 2
bOi − EXPi g
χ =
2
EXPi
i =1
df = k − 1
The observations are sorted into ascending order X b1g to X b N g . The empirical
cdf, F$ b X g , is
Uniform
minimum = X b1g
maximum = X b N g
Normal
∑
N
mean d X i = Xi N
i =1
∑ ∑ ∑
F N F N IF N II
standard deviation bS g = G X i2 −G Xi N JG Xi JJ bN − 1g
G G JG JJ
H i =1 H i =1 K H i =1 KK
4 NPAR TESTS
Poisson
∑
N
mean bλ g = Xi N
i =1
The test is not done if, for the uniform, all data are not within the user-specified
range or, for the Poisson, the data are not non-negative integers. If the variance of
the normal or the mean of the Poisson is zero, the test is also not done.
For Uniform
X i − min
F0 b X i g =
max − min
For Poisson
∑ e − λ λl
Xi
F0 b X i g =
l!
l =0
For Normal
F Xi − X I
F0 b X i g = F0,1 G J
H S K
Calculation of Differences
For the Uniform and Normal, two differences are computed:
Di = F$ b X i −1 g − F0 b X i g
~
Di = F$ b X i g − F0 b X i g i = 1, K, N
For the Poisson:1
R
|F$ b Xi − 1g − F b Xi − 1g
Di = S
Xi > 0 i = 1, 2, K, N.
|0
T Xi = 0
~
Di = F$ b Xi g − Fb Xi g
~
Z= N maxi e Di , Di j
The two-tailed probability level is estimated using the first three terms of the
Smirnov (1948) formula.
−2
where Q = e −1.233701Z .
if 1 ≤ Z < 31
., p = 2eQ − Q 4 + Q 9 − Q16 j
where Q = e −2 Z .
2
if Z ≥ 31
., p=0.
Runs Test
Computation of Cutting Point
The cutting point which is used to dichotomize the data can be specified as a
particular number, or the value of a statistic which is to be calculated. The
possible statistics are
∑
N
Mean = Xi N
i =1
RX
|e b N 2 +1g + Xb N 2 g j 2 if N is even
Median = S
| Xba N +1f 2 g if N is odd
T
where the data are sorted in ascending order from X b1g , the smallest, to
X b N g , the largest.
If there are multiple modes, the one largest in value is selected and a warning
printed.
NPAR TESTS 7
Number of Runs
For each of the data points, in the sequence in the file, the difference
Di = X i − CUTPOINT
Significance Level
2 n p na
µr = +1
n p + na
2n p na d2n p na − na − n p i
σr = 2
dn p + na i dn p + na − 1i
R − µr
Z=
σr
Rb R − µ r + 0.5g σ r if R − µ r ≤ 0.5
|
Zc = Sb R − µ r − 0.5g σ r if R − µ r ≥ 0.5
|0 if R − µ r < 0.5
T
8 NPAR TESTS
Binomial Test
p∗ p if m = n1 , 1 − p if m = n2
∑
F m N −i I N −m
F NI F NI
2G G J p ∗i e1 − p∗ j J −G J p∗m e1 − p∗ j
G H i K J H mK
H i =0 K
n1 + 0.5 − Np n1 − 0.5 − Np
Z1 = Z2 =
Npb1 − pg Npb1 − pg
Pb Zi g = probability from standard normal distribution
Then,
Pb X = n1 g = PbZ 2 g − Pb Z1 g
Pb X ≤ n1 g = Pb Z1 g
2 Pb X ≤ n1 g − Pb X = n1 g
NPAR TESTS 9
McNemar’s Test
Table Construction
The data values are searched to determine the two unique response categories. If
the variables X and Y take on more than two values, or only one value, a
message is printed and the test is not done. The number of cases that have
X i < Yi bn1 g or X i > Yi bn2 g are counted.
∑
r
F n1 + n2 I n1 + n2
pb X ≤ r g = G J b0.5g
H i K
i =0
2
c n1 − n2 − 1h
χ 2c = , df = 1
n1 + n2
Sign Test
Count of Signs
For each case, the difference
Di = X i − Yi
∑
r
Fnp + nn I n p + nn
pb X ≤ r g = G J b0.5g
H i K
i =0
Di = X i − Yi
X p = Sp np
NPAR TESTS 11
X n = S n nn
where n p is the number of cases with positive differences and nn the number
with negative differences.
mind S p , Sn i − cnbn + 1g 4h
Z=
∑
l
nbn + 1gb2n + 1g 24 − 3
et j − t j j 48
j =1
where
n Number of cases with non-zero differences
l Number of ties
K
tj Number of elements in the j-th tie,
j = 1, , l
Cochran’s Q Test
Computation of Basic Statistics
For each of the N cases, the k variables specified may take on only one of two
possible values. If more than two values, or only one, are encountered, a message
is printed and the test is not done. The first value encountered is designated a
“success” and for each case the number of variables that are “successes” are
counted. The number of “successes” for case i will be designated Ri and the
total number of “successes” for variable l will be designated Cl .
∑ ∑
L k 2O
F k I
M P
b k − 1gMk Cl − G
2
Cl J P
G J
M l =1 H l =1 K P
N Q
Q=
∑ ∑
k N
k Cl − Ri2
l =1 i =1
Rl = Cl N
∑
k
c12 Nk b k + 1gh Cl2 − 3 N b k + 1g
∑
l =1
χ2 =
1− T Nk e k 2 − 1j
F N 2 k e k 2 − 1j 12 I
F
F IG
W=
∑
J
G
N bk − 1g JK G N 2 k e k 2 − 1j 12 − N
H T 12 J
H K
∑ ∑∑
N k
T= et
3
− tj
i =1 l =1
with t = number of variables tied at each tied rank for each case.
χ 2 = N bk − 1gW
R X
|e N 2 + X N 2 +1 j 2 if N is even
Md = S
| X b N +1g 2 otherwise
T
where X N is the largest value and X 1 the smallest. The number of cases in
each of the two groups which exceed the median are counted. These will be
denoted as g1 and g2 , and the corresponding sample sizes as n1 and n2 .
2
g1 bn2 − g2 g − g2 bn1 − g1 g − N 2 N
χ 2c =
b g1 + g2 gbn1 + n2 − g1 − g2 gn1n2
Mann-Whitney U Test
Calculation of Sums of Ranks
The combined data from both groups are sorted and ranks assigned to all cases,
with average rank being used in the case of ties. The sum of ranks for each of the
t3 − t
groups b S1 and S2 g is calculated, as well as, for tied observations, Ti = ,
12
where t is the number of observations tied for rank i .
The average rank for each group is
Si = Si ni
n1 bn1 + 1g
U = n1n2 + − S1
2
U ' = n1n2 − U
• If n1n2 ≤ 400 and n1n2 2 + min(n1 , n2 ) ≤ 220 the exact significance level is
based on an algorithm of Dineen and Blakesley (1973).
bU − n1n2 2g
Z=
n1n2 F N 3 − N
∑
I
G − Ti J
N b N − 1g GH 12 J
K
i
R0 −∞ < X < X 1
|
|
F$i b X g = S j ni X j ≤ X < X j +1
|1 X n ≤ X <∞
|
T 1
For all of the X j values in the two groups, the difference between the two
groups is
D j = F$1 d X j i − F$2 d X j i
where F$1d X j i is the cdf for the group with the larger sample size. The
maximum positive, negative, and absolute differences are also computed.
n1n2
Z = max D j
j n1 + n2
j
NPAR TESTS 17
Significance Level
If n1 + n2 , the total sample size, is less than or equal to 30, the one-sided
significance level is exactly calculated from
∑
R
2 F n1 − 1 I F n2 − 1 I
Pbr ≤ R g = G JG J
+
F 1 n2 I
n H r 2 − 1K H r 2 − 1K
G J r =2
H n1 K
∑
R
1 LF n1 − 1I F n2 − 1I F n1 − 1I F n2 − 1I O
Pbr ≤ R g = MG JG J +G JG JP
F n1 + n2 I H k − 1K H k − 2 K H k − 2K H k − 1 K Q
G J r =2 N
H n1 K
where
r = 2k − 1 .
For sample sizes greater than 30, the normal approximation is used (see RUNS
test described previously).
18 NPAR TESTS
Significance Level
The exact one-tailed probability level is computed from
∑
g
LF i + nc − 2 h − 2I F ne + 2 h + 1 − i I O
MG JG JP
H i KH ne − i KQ
i =0 N
PbSPAN ≤ nc − 2h + g g =
F nc + ne I
G J
H nc K
Censoring of Range
The test is repeated, dropping the h lowest and h highest ranks from the control
group. If not specified by the user, h is taken to be the integer part of 0.05nc or 1,
whichever is greater. If h is user specified, the integer value is used unless it is
less than one. The significance level is determined as above.
NPAR TESTS 19
R X
|e N 2 + X N 2 +1 j 2 if N is even
Md = S
| X b N +1g 2 if N is odd
T
∑∑
k 2
2
χ =
2
dOij − Eij i Eij
j =1 i =1
where
Ri n j
Eij = .
N
20 NPAR TESTS
∑
k
12
H= Ri2 ni − 3b N + 1g
N b N + 1g
i =1
H
H′ =
∑
m
1− Ti eN
3
− Nj
i =1
References
Dineen, L. C., and Blakesley, B. C. 1973. Algorithm AS 62: Generator for
the sampling distribution of the Mann-Whitney U statistic. Applied
Statistics, 22: 269–273.