ENV 260/SDV 360

advertisement
ENV 260
Summary of the two approaches to drawing conclusions from an experiment consisting of
a single sample from a population.
Confidence Interval
Suppose a random sample of size n is drawn from population having unknown mean μ.
A 95% confidence interval for μ is
x  t*
s
n
where x is the sample mean and s is the sample standard deviation. This interval is
exact when the population is normal and is approximately correct for large n in other
cases. Note that when n is small and the population is not normal, this formula can lead
to incorrect results and therefore cannot be used.
Here t * is chosen so that the area under the t probability distribution function with n  1
degrees of freedom between  t * and t * is 0.95.
The meaning of the confidence interval
If one were to sample the population with samples of size n repeatedly, then about 95%
of the time, the population mean μ would be contained in the interval formed from each
sample.
The image shown below depicts 60 random samples from a population of mean μ. For
each sample the 95% confidence interval is shown. Confidence intervals colored green
contain the mean of the population. Confidence intervals in red do not contain the
population mean. About 1 in 20 times, or in this case 3 times out of 60, the interval does
not contain the population mean.
One Sample Hypothesis Test
Suppose a random sample of size n is drawn from population having unknown mean μ.
To test the hypothesis H 0 : μ  μ 0 based on the sample, compute the one-sample t
statistic
t
x  μ0
s
n
In terms of a random variable T having a t distribution with n  1 degrees of freedom, the
p-value for a test of H 0 against
H a : μ  μ 0 is Prob(T  t)
H a : μ  μ 0 is Prob(T  t)
H a : μ  μ 0 is 2Prob(T  |t|)
The p-values are exact if the population distribution is normal and are approximately
correct for large n in other cases.
The meaning of the p-value
The p-value gives the probability, under the hypothesis that the mean of the population is
μ 0 , of taking a sample of size n and getting a sample mean as extreme or more extreme
as the obtained in the sample. If this probability is large, we say that we cannot reject the
null hypothesis H 0 . It this probability is small (often 5% is the threshold), then we say
we can reject the null hypothesis H 0 .
Example of a two-sided test done both ways
In order for an experimental process to purify drinking water to be useful, it must not
change the pH of the treated water which is neutral (pH = 7.0). To assess the process, the
mean of a sample of pH values of the treated water is compared to the hypothetical mean
of 7.0.
Here is the data:
5.95
7.58
6.54
7.39
6.62
6.67
6.88
6.96
7.25
6.54
6.90
6.92
6.50
6.93
7.21
6.73
6.32
6.83
6.69
7.22
6.80
6.95
6.36
6.59
In either approach, as the number in the sample is on the small side, we should check to
see if the sample is reasonably normal. This is a check of the hypothesis that the original
population is normal. We usually do this with a normal probability plot:
As the normal probability plot is reasonably linear (and the p-value is greater than 0.05,
more on that at a future date), it is safe to use our techniques here.
In the confidence interval approach, we calculate the 95% confidence interval for the
mean. If the interval contains 7.0 then we conclude that the process is probably not
changing the pH; if the interval doesn’t contain 7.0, we conclude that process is in fact
changing the pH.
The mean is 6.8054 and the sample standard deviation is 0.3660. The t-value we are
interested in the critical value for 0.025 with 23 degrees of freedom which is 2.0687.
You can get this t value in Excel with TINV(0.05,23) or in Minitab with Calc>Probability Distributions->t distribution inverse cumulative probability with 23 degrees
of freedom and an input constant of 0.25. Note how confusing Excel is here; it is
extremely easy to make a mistake with Excel here.
Thus the 95% confidence interval is
0.3660
24
or 6.65 to 6.96. Since 7.0 is not contained in the interval, we conclude that the treatment
is changing the pH, making slightly acidic.
6.8054  2.0687
As for the hypothesis testing approach, our null hypothesis is H 0 : μ = 7.0 . For a two
sided test as here the alternative hypothesis is H a : μ  7.0 . We calculate the t statistic:
6.8054  7.0
 2.60
0.3660
24
In a two sided test, the p-value is 2 times the probability that t23 > 2.60 . This is 2 times
0.008 or 0.016. This means that if the mean of pH of the treated water really were 7.0,
one would get results as extreme or more extreme as the results we got with the sample of
24 only 1.6% of the time. So it is rather unlikely that null hypothesis is true, so we can
reject it.
In Minitab, everything is extremely automatic. Use Stat->Basic Statistics->1-sample t.
Both approaches are done totally automatically for you. It is almost too easy.
Test of mu = 7 vs mu not = 7
Variable
C1
Variable
C1
N
24
(
Mean
6.8054
95.0% CI
6.6509, 6.9600)
StDev
0.3660
SE Mean
0.0747
T
-2.60
P
0.016
Example of a one sided test
Suppose we want to test the hypothesis that mothers with low socioeconomic status
deliver babies whose birth weights are lower than normal. To test this hypothesis, a list is
obtained of birth weights from 100 consecutive, full term, live-born deliveries from the
maternity ward of a hospital in a low socioeconomic status area. The mean birth weight
of the sample is found to be 115 oz. with a sample standard deviation of 24 oz. Suppose
we know from nationwide surveys based on million of deliveries that the mean birth
weight in the United States is 120 oz. Can we actually say the underlying mean birth
weight from this hospital is lower than the national average?
We want to test the hypothesis H 0 : μ  120 with the alternative hypothesis of
H a : μ  120 . We calculate the t statistic:
t
115  120 5

 2.08
24
2.4
100
For a one-sided test as this one, we calculate the probability of t99  2.08 . In Excel, you
can use TDIST(2.08,99,1). Note that in Excel, you cannot enter negative values for the
first argument. Also in Excel, 1 in the last argument stands for a one-sided test, while 2
in the last argument stands a two-sided test. The p-value is 0.02 well under 0.05. Thus
at the 95% confidence level, we can reject the null hypothesis that the mean birth weight
of the babies from this hospital is the same as the general population.
Warning About Excel
TINV is inherently two sided (so for a 95% confidence interval you use TINV(0.05,….)
instead of TINV(0.025,….) ), while TDIST gives the option of one sided or two sided.
Excel has no built-in capability for one sample tests or one sample confidence intervals.
Stick to Minitab or other statistical software for one sample t-tests.
Download