Wolfram Alpha:
Search by keyword:
Astronomy
Chemistry
Classical Mechanics
Classical Physics
Climate Change
Cosmology
Finance and Accounting
Game Theory
General Relativity
Group Theory
Lagrangian and Hamiltonian Mechanics
Macroeconomics
Mathematics
Microeconomics
Nuclear Physics
Particle Physics
Probability and Statistics
Programming and Computer Science
Quantum Computing
Quantum Field Theory
Quantum Mechanics
Semiconductor Reliability
Solid State Electronics
Special Relativity
Statistical Mechanics
String Theory
Superconductivity
Supersymmetry (SUSY) and Grand Unified Theory (GUT)
The Standard Model
Topology
Units, Constants and Useful Formulas
Non Parametric Tests
--------------------
Up until now it has been assumed that the underlying distributions
from which the samples have been drawn is normally distributed
OR the sample sizes are big enough (typically greater than 30)
so that the central limit theorem applies (i.e. the means of
the samples follow a normal distribution). But what if these
assertions are not true - we are dealing with small sample sizes
and we know nothing about the parent population? Enter non
parametric testing! There are 6 non-parametric tests of
importance.
The Sign Test
-------------
This is used for testing hypotheses about the central tendency
of a non-parametric distribution. It provides inferences about
the population median, η, rather than the population mean, μ.
H_{0}: η = η_{0}
H_{1}: η < η_{0} or η > η_{0}
_{ } η ≠ η_{0}
Test statistic:
S = # of measurements < (or >) η_{0} (1 tailed)
= Larger of # of measurements < η_{0} and > η_{0} (2 tailed)
p value: P(x ≥ S) (1 tailed)
2P(x ≥ S) (2 tailed)
Where x has a binomial distribution with n = p = 0.5.
P(x ≥ S) = Probability of S successes in n trials.
Reject H_{0} if p value ≤ α
Large Samples
------------
If n ≥ 30 we can use the normal approximation to the binomial.
Z = [(S - 0.5) - 0.5n]/0.5√n
Where 0.5 is the 'continuity correction', the mean, np = 0.5n
and the standard deviation is √(npq) = √(n(0.5)(0.5)) = 0.5√n
Example:
Determine whether η is less than 1.00.
H_{0}: η = 1.00
H_{1}: η < 1.00
Test Results
------------
0.78
0.51
3.79
0.23
0.77
0.98
0.96
0.89
S = # of measurements < η
= 7
P(x ≥ 7) = Probability of 7 successes in 8 trials
= 1 - P(x ≤ 6)
= 1 - 0.965 from Binomial tables
= 0.035
Therefore, reject H_{0} at the α = 0.05 level.
The Wilcoxon Rank Sum (a.k.a The Mann-Whitney U Test)
-----------------------------------------------------
This is the non-parametric analog of the independent samples
t-test.
H_{0}: The 2 distributions D_{1} and D_{2} are identical.
H_{1}: D_{1} is shifted to the right of D_{2}.
_{ } D_{1} is shifted to the left of D_{2}.
_{ } D_{1} is shifted either to the left or the right of D_{2}.
Test statistic:
Rank every observation as though they were all drawn from the
same population with Rank 1 being the lowest observation.
Assign ascending ranks to observation with the same value and
divide by the number of observations with the same value.
For example
Rank: 1 3 2 4 8 5 7 6 9 10
Observation: 1.1 2.3 2.1 3.3 4.2 3.3 4.0 3.3 4.4 5.2
=> 1 3 2 5* 8 5* 7 5* 9 10
* 3.3 => (4 + 5 + 6)/3 = 5
To find the test statstic we take the sum of the ranks for
the smaller sample size (or either if n_{1} = n_{2}).
Use the Wilcoxon Rank Sum Tables to obtain the upper and lower
rejection regions, T_{U} and T_{L}. n_{1} corresponds to columns and
n_{2} corresponds to rows.
Rejection region:
If n_{1} < n_{2}:
T_{1} ≥ T_{U} : T_{1} ≤ T_{L} (1 tailed).
T_{1} ≥ T_{U} or T_{1} ≤ T_{L} (2 tailed).
If n_{2} < n_{1}:
T_{2} ≥ T_{U} : T_{2} ≤ T_{L} (1 tailed).
T_{2} ≥ T_{U} or T_{2} ≤ T_{L} (2 tailed).
Large Samples
------------
If n_{1} ≥ 10 and n_{2} ≥ 10 we can use the Z statistic for the
hypthesis test.
T_{1} - (n_{1}(n_{1} + n_{2} + 1))/2
Z = -----------------------
√(n_{1}n_{2}(n_{1} + n_{2} + 1)/12)
Example:
Comparison of drug reaction times.
Drug A Drug B
Reaction Time Rank Reaction Time Rank
------------- ---- ------------- ----
1.96 4 2.11 6
2.24 7 2.43 9
1.71 2 2.07 5
2.41 8 2.71 11
1.62 1 2.50 10
1.93 3 2.84 12
2.88 13
-- --
Rank Sum 25 66
Sample Size, n 6 7
H_{0}: The reaction times for A and B have the same
_{ } probability distribution.
H_{1}: The reaction times for A are shifted to the left
_{ } or right of the reaction times for B.
T_{1} = 25
T_{2} = 66
From the Wilcoxon Paired Difference Rank Sum Tables:
n_{1} = 6, n_{2} = 7, α = 0.05 => T_{L} = 28 and T_{U} = 56 (2 tailed)
Therefore, reject H_{0} at the α = 0.05 level because T_{1} (the
smaller sample size) falls in the rejection region.
t-test comparison:
The t-value is -2.9927. The 2 tailed p-value is 0.0122.
The result is significant at p < 0.05.
Note: If we had a 1 tailed test with H_{1}: A is shifted to
the left of B then T_{L} = 30 and T_{U} = 54 (1 tailed) for α = 0.05.
In this case T_{1} is not in the rejection region so we would
accept H_{0}.
Wilcoxon Paired Difference Signed Rank Test
-------------------------------------------
This is the non-parametric analog of the paired t-test.
H_{0}: The 2 distributions D_{1} and D_{2} are identical.
H_{1}: D_{1} is shifted to the right of D_{2}.
_{ } D_{1} is shifted to the left of D_{2}.
_{ } D_{1} is shifted either to the left or the right of D_{2}.
Test statistic:
Calculate the ranks of the absolute values of the differences.
Rank every observation as though they were all drawn from the
same population with Rank 1 being the lowest observation.
Determine the sum of the ranks of the positive and negative
differences of the original measurements. 0 differences are
eliminated and n reduced accordingly.
Find T_{0} from the Wilcoxon Paired Difference Signed Rank
Tables with n = number of pairs.
Rejection region:
Consider the difference between 2 distributions D_{1} - D_{2}.
1 tailed:
If D_{1} is to the right of D_{2}, more positive differences should
occur. Therefore, T_{+} > T_{-} and the rejection criterion is
T_{-} ≤ T_{0}.
If D_{1} is to the left of D_{2}, more negative differences should
occur. Therefore, T_{-} > T_{+} and the rejection criterion is
T_{+} ≤ T_{0}
2 tailed:
If D_{1} is shifted to the left or right of D_{2} then the rejection
criterion is the smaller of T_{-} or T_{+} ≤ T_{0}.
Large Samples
------------
If n_{1} ≥ 10 and n_{2} ≥ 10 we can use the Z statistic for the
hypthesis test.
T_{1} - n(n + 1)/4
Z = ---------------------
√(n(n + 1)(2n + 1)/24)
Example:
Before and after test.
A B (A - B) |A - B| Rank Modified Rank
-- -- ------- ------- ---- ------------
12 8 4 4 4 4.5
16 10 6 6 7 7
8 9 -1 1 1 1
10 8 2 2 2 2
19 12 7 7 8 8
14 17 -3 3 3 3
12 4 8 8 9 9
10 6 4 4 5 4.5
12 17 -5 5 6 6
16 4 12 12 10 10
H_{0}: A and B have the same probability distribution.
H_{1}: A and B have different probability distributions.
T_{-} = 10
T_{+} = 45
From the Wilcoxon Paired Difference Signed Rank Tables:
n = 10, α = 0.05 => T_{0} = 8 (2 tailed)
Therefore, accept H_{0} at the α = 0.05 level because T_{-} is
not in the rejection region.
t-test comparison:
The t-value is 2.0466. The 2 tailed p-value is 0.0710.
The result is not significant at p < 0.05.
Note: If we had a 1 tailed test with H_{1}: A is shifted to
the left of B then T_{0} = 11 for α = 0.05. In this case T_{+}
is not in the rejection region so we would again accept H_{0}.
Kruskal-Wallis H Test
---------------------
This is the non-parametric analog of the ANOVA test for a
completely randomized design.
H_{0}: The distributions D_{k} are identical.
H_{1}: At least 2 of the distributions differ in location.
Test statistic:
_{ } __{ } _
H = (12/n(n + 1))Σn_{j}(R_{j} - R)^{2}
or, equivalently:
H = (12/n(n + 1))ΣR_{j}^{2}/n_{j} - 3(n + 1)
Where,
R_{j} = Rank sum for sample j.
n_{j} = number of measurements in jth sample.
_
R_{j} = R_{j}/n_{j} = mean rank sum for sample j.
_
R = (n + 1)/2 = mean of all ranks.
n = n_{1} + n_{2} + ... + n_{k} = total sample size.
= number of ranks.
Rejection region:
H > χ_{α}^{2} with k - 1 df
Example:
Comparison of unoccupied bed space for 3 different hospitals
on 10 successive days.
H1 H2 H3
Beds Rank Beds Rank Beds Rank
---- ---- ---- ---- ---- ----
6 5 34 25 13 5
38 27 28 19 35 26
3 2 42 30 19 15
17 13 13 9.5 4 3
11 8 40 29 29 20
30 21 31 22 0 1
15 11 9 7 7 6
16 12 32 23 33 24
25 17 39 28 18 14
5 4 27 18 24 16
--- ----- -----
Rank suns 120 210.5 134.5
H_{0}: Distributions for all 3 hospitals are the same.
H_{1}: At least 2 of the hospitals have distributions
_{ } that differ in location.
n_{1} = n_{2} = n_{3} = 10
_
R_{1} = 120/10 = 12.0
_
R_{2} = 210.5/10 = 21.05
_
R_{3} = 134.5/10 = 13.45
_
R = (30 + 1)/2 = 15.5
=> H = 6.097
From the χ^{2} tables with α = 0.05 and (k - 1) = 2 df we get
χ_{0.05}^{2} = 5.991
Since H > 5.991 we can reject H_{0}.
Friedman F Test
---------------
This is the non-parametric analog of the ANOVA test for a
randomized block design.
Test statistic:
_{ } __{ } _
F = (12b/k(k + 1))Σ(R_{j} - R)^{2}
or, equivalently:
F = (12/bk(k + 1))ΣR_{j}^{2} - 3b(k + 1)
Where,
b = number of blocks.
k = number of treatments.
n_{j} = number of measurements in jth sample.
R_{j} = Rank sum for jth treatment where the rank of each
measurement is found relative to its position in its
own block (the measurements can are ranked in blocks).
_
R_{j} = R_{j}/n_{j} = mean rank sum for sample j.
_
R = (n + 1)/2 = mean of all ranks where n = number of ranks.
Rejection region:
F > χ_{α}^{2} with k - 1 df
Example:
Drug reaction times.
Block Drug A Rank Drug B Rank Drug C Rank
----- ------ ---- ------ ---- ------ ----
1 1.21 1 1.48 2 1.56 3
2 1.63 1 1.85 2 2.01 3
3 1.42 1 2.06 3 1.70 2
4 2.43 2 1.98 1 2.64 3
5 1.16 1 1.27 2 1.48 3
6 1.94 1 2.44 2 2.81 3
-- -- --
Rank sums 7 12 17
H_{0}: The reaction times for A, B and C have the same
_{ } probability distributions.
H_{1}: At least 2 of the drugs have reaction times whose
_{ } distributions differ by location.
k = 3
b = 9
_
R_{1} = 7/6 = 1.167
_
R_{2} = 12/6 = 2.0
_
R_{3} = 17/6 = 2.833
_
R = (3 + 1)/2 = 2.0
=> F = 8.33
From the χ^{2} tables with α = 0.05 and (k - 1) = 2 df we get
χ_{0.05}^{2} = 5.991
Spearman's Rank Correlation
---------------------------
This is the non-parametric analog of Pearson correlation.
SS_{uv}
r_{S} = ----------
√(SS_{uu}SS_{vv})
Where:
_ _
SS_{uv} = Σ(u_{i} - u)(v_{i} - v) ≡ Σu_{i}Σv_{i}/n
_
SS_{uu} = Σ(u_{i} - u)^{2} ≡ Σ(u_{i})^{2} - (Σu_{i})^{2}/n
_
SS_{vv} = Σ(v_{i} - v)^{2} ≡ Σ(v_{i})^{2} - (Σv_{i})^{2}/n
n is the number of data points.
u_{i} is the rank of the ith observation in sample 1.
v_{i} is the rank of the jth observation in sample 2.
In this case the independent variables are ranked separately.
Example:
Cigarettes smoked per day vesus birth weight.
Cigs/day Rank Weight Rank
-------- ---- ------ ----
12 1 7.7 2
15 2 8.1 3
35 5 6.9 1
21 4 8.2 4.5
20 3 8.2 4.5
SS_{uu} = 10
SS_{vv} = 9.5
SS_{uv} = -0.5
r_{S} = -0.5/√(10*9.5) = -0.051