Lecture 9 - University of Pennsylvania

Download Report

Transcript Lecture 9 - University of Pennsylvania

Lecture 9
• Today:
– Log transformation: interpretation for population
inference (3.5)
– Rank sum test (4.2)
– Wilcoxon signed-rank test (4.4.2)
• Thursday:
–
–
–
–
Welch’s t-test (4.3.2)
Practical vs. statistical significance (4.5.1)
Presentation of statistical findings (4.5.2)
Begin review if time
• Next Tuesday (2/17): Review
• Next Thursday (2/19): Midterm
When to use log transformation
What indicates that log might work in making
distributions have same spread and symmetric
shape?
– Distributions are skewed
– Spread is greater in the distribution with larger center
– The data values differ by orders of magnitude, e.g., as a
rough guide, the ratio of the largest to the smallest is
>10 (or perhaps >4)
– Multiplicative statement is desirable
Example
• Study of cellular immunity in infectious
mononucleosis. Two groups of healthy controls
were considered. One group of 16 Epstein-Barr
virus seropositive donors and another group of 10
Epstein-Barr virus seronegative donors. The file
cellimmunity.JMP contains stimulation indices
with the P3HR-1 virus as antigen. The interest is
in testing whether there is any difference between
seropositive and seronegative donors in
stimulation indices.
Oneway Analysis of Stimulation Index By Group
Stimulation Index
15
10
5
0
Seronegative
Seropositive
Group
Oneway Analysis of Log Stimulation Index By Group
3
Log Stimulation Index
2.5
2
1.5
1
0.5
0
-0.5
Seronegative
Seropositive
Group
Log Transformation for
Population Inference
• Consider comparing means of two populations. If
the populations appear skewed with the larger
population having the larger spread, using the ttools to analyze the log transformed data
Z1  log(Y1 ), Z2  log(Y2 ) might be more appropriate.
• Using the t-tools on the log transformed data is
appropriate (i.e., produces approximately valid
results) if Z1 and Z 2 are approximately normally
distributed.
Inference for Population Medians
• If distributions of Z1=log(Y1) and Z2=log(Y2)
appear approximately normal with equal SD, then
we can make inferences about the ratio of
population medians for Y1 and Y2 as follows:
– To test if population medians are the same, test the null
hypothesis that the means of Z1 and Z2 are the same
– An estimate of the ratio of the population 2 median to
the population 1 median is exp( Z 2  Z1 ).
– To form a confidence interval for the ratio of population
medians, form a confidence interval for the difference
in the means of Z1 and Z2, (U,L). A confidence interval
for the ratio of the population 2 median to the
population 1 median is
(eL , eU )
Cellular Immunity Example
Oneway Analysis of Log Stimulation Index By Group
t Test
Seronegative-Seropositive
Assuming equal variances
Difference
Std Err Dif
Upper CL Dif
Lower CL Dif
Confidence
-0.8716
0.2615
-0.3319
-1.4113
0.95
t Ratio
DF
Prob > |t|
Prob > t
Prob < t
-3.33341
24
0.0028
0.9986
0.0014
H :
H :
Test of 0 population medians are the same vs. a population medians are not the
same: p-value = .0028. Strong evidence that seropositive donors have higher median
stimulation index than seronegative donors.
Estimate of ratio of population median of seronegative donors to seropositive donors is
exp(0.8716)  0.4183.
Confidence interval for ratio of population median of seronegative donors to seropositive
donors is
(exp(-1.4113),exp(-.3319)) = (0.2438, 0.7176).
Other transformations
• Square root transformation Y - applies to data
that are counts and to measurements of area
• Reciprocal transformation 1 / Y - applies to data
that are waiting times (e.g., time to failure of
lightbulbs), reciprocal of time measurement can
often be interpreted directly as a rate or a speed
• Goals of transformation: Establish a scale on
which two groups have roughly the same spread.
– Inferences from log transformation are directly interpretable when
converted back to original scale of measurement. Other
transformations are not so easily interpretable, e.g., square of
difference between means of Y and Y is not so easily
interpretable.
2
1
Nonparametric Methods
• Nonparametric (distribution free) methods do not
assume that the population distributions follow
any particular form.
• (Wilcoxon) rank-sum test – Chapter 4.2.
– Let F and G denote the population distributions of
group 1 and group 2. Tests H0 : F  G vs.
H a : F  G by comparing the ranks of the two
groups.
– Advantages: Distribution free, resistant. Drawbacks:
Confidence interval is difficult to get and difficult to
extend to more complicated settings.
Rank Sum Test
1. List all observations from both samples in
increasing order.
2. Identify which sample each observation came
from.
3. Create a new column labeled “order,” as a
straight sequence of numbers from 1 to
4. Search for ties in the combined data set. The
ranks for tied observations are taken to be the(n1  n2 )
average of the orders for those cases.
5. The test statistic T is the sum of all the ranks in
the first group. We reject for values of T that
are far away from the mean of T under H0.
Exact computation of p-value
• Under H0: F=G, the ranks are randomly
distributed among the two groups.
• Exact p-value: Enumerate all possible
groups and reject H0 if T is far away from
its mean.
Example
• Two subjects in each group. Group I: 1, 3. Group
II: 4,6
• T=3
• There are 24 possible groupings of the ranks.
Under H0, the groupings are equally likely and
P(T=3)=1/6, P(T=4)=1/6, P(T=5)=1/3,
P(T=6)=1/6, P(T=7)=1/6
• Two sided p-value = Probability that T would be at
least as far from its mean under the null
hypothesis (5) as the observed T (3) = 2/6.
Normal approximation to p-value
T  Mean(T )
SD(T )
• Let
where the mean(T) and
SD(T) refer to the mean and SD under H0:
F=G. Under H0, z has approximately
standard normal distribution when n1, n2  5
• Approximate p-value: Probability that
standard normal r.v. would be at least as far
from zero as observed test statistic z,
Prob>|Z| in JMP.
z
Rank Sum Test in JMP
• Analyze, Fit Y by X.
• Click red triangle next to Oneway Analysis
and click Nonparametric, Wilcoxon Test.
• The p-value is listed under 2 Sample Test,
Normal Approximation. The p-value is
Prob>|Z|.
Oneway Analysis of Stimulation Index By Group
Stimulation Index
15
10
5
0
Seronegative
Seropositive
Group
Wilcoxon / Kruskal-Wallis Tests (Rank Sums)
Level
Seronegative
Seropositive
Count
10
16
Score Sum
78
273
2-Sample Test, Normal Approximation
S
78
Z
-2.98343
Prob>|Z|
0.0029
1-way Test, ChiSquare Approximation
ChiSquare
9.0591
DF
1
Prob>ChiSq
0.0026
Score Mean
7.8000
17.0625
(Mean-Mean0)/Std0
-2.983
2.983
Cognitive Load in Teaching
• Case Study 4.1.2
• A randomized experiment was done to compare (i)
a conventional approach to teaching coordinate
geometry in which presentation is split into
diagram, text and algebra with (ii) a modified
approach in which algebraic manipulations and
explanations are presented as part of the graphical
display. Students’ performance on a test was
compared after being taught by two methods.
• Both distributions are highly skewed. In addition,
there were five students who did not come to any
solution in the five minutes allotted so that their
solution times are censored (all that is known
about them is that they exceed 300 seconds.
Oneway Analysis of TIME By TREATMT
350
300
TIME
250
200
150
100
50
CONVENTIONAL
MODIFIED
T REAT MT
Wilcoxon / Kruskal-Wallis Tests (Rank Sums)
Level
CONVENTIONAL
MODIFIED
Count
14
14
Score Sum
269
137
2-Sample Test, Normal Approximation
S
137
Z
-3.01826
Prob>|Z|
0.0025
1-way Test, ChiSquare Approximation
ChiSquare
9.2495
DF
1
Prob>ChiSq
0.0024
Score Mean
19.2143
9.7857
(Mean-Mean0)/Std0
3.018
-3.018
Wilcoxon Signed Rank Test
•
•
•
Chapter 4.4.2
Wilcoxon Signed Rank Test: distribution free
test ofH0 : Diff  0 for a matched pairs
experiment (where it is assumed that distribution
of differences is symmetric).
Signed-rank statistic:
1. Compute the difference in each of the n pairs
2. Drop zeros from list
3. Order the absolute differences from smallest to
largest and assigned them ranks 1,…,n (average rank
for ties)
4. Signed rank statistic S is the sum of the ranks from
pairs for which the difference is positive.
Computing p-value
• Under H0 : diff  0, the assignment of the
observations in each pair to treatment or control
are randomly distributed. Exact p-value can be
determined.
• JMP uses a normal approximation to calculate pvalue (reliable if number of pairs 20).

• Wilcoxon Signed Rank test in JMP: Analyze,
Distribution, Test Mean, click box Wilcoxon
Signed Rank test.
Schizophrenia Study
Distributions
Difference
-0.2
0
.2
.4
.6
.8
Test Mean=value
Hypothesized Value
Actual Estimate
df
Std Dev
Test Statistic
Prob > |t|
Prob > t
Prob < t
0
0.19867
14
0.23829
t Test
3.2289
0.0061
0.0030
0.9970
Signed-Rank
51.000
0.002
0.001
0.999
Duality between CI and
Hypothesis Tests
• Confidence interval: Range of plausible values for
parameter.
• Connection to hypothesis testing: A parameter
value is plausible if it cannot be rejected when it is
considered as the null hypothesis.
• CI based on hypothesis tests: The set of values
which are not rejected by two sided hypothesis
tests at the 0.05 significance level is a 95% CI.
CI using Signed Rank Test
• See Section 4.2.4.
• To test H0 : Diff  * using Wilcoxon Signed Rank
Test, we use the sum of ranks from pairs for which
difference is   * . In JMP, set “Specify
Hypothesized Mean” equal to  *
• By trial and error, we can find approximately the
smallest and largest  * for which  * is not
rejected at the .05 significance level (i.e., has pvalue > .05). These are the endpoints of a 95%
confidence interval. The conditions for validity of
this CI are the same as those for Wilcoxon Signed
Rank Test – random sampling and distribution of
differences is symmetric.