Download STAT 145 (Notes) - Department of Mathematics and Statistics

Document related concepts

Psychometrics wikipedia , lookup

Sufficient statistic wikipedia , lookup

Foundations of statistics wikipedia , lookup

History of statistics wikipedia , lookup

Degrees of freedom (statistics) wikipedia , lookup

Bootstrapping (statistics) wikipedia , lookup

Taylor's law wikipedia , lookup

Misuse of statistics wikipedia , lookup

Resampling (statistics) wikipedia , lookup

Student's t-test wikipedia , lookup

Transcript
STAT 145 (Notes)
Al Nosedal
[email protected]
Department of Mathematics and Statistics
University of New Mexico
Fall 2013
CHAPTER 18
INFERENCE ABOUT A POPULATION MEAN.
Conditions for Inference about mean
I
We can regard our data as a simple random sample (SRS)
from the population. This condition is very important.
I
Observations from the population have a Normal distribution
with mean µ and standard deviation σ. In practice, it is
enough that the distribution be symmetric and single-peaked
unless the sample is very small. Both µ and σ are unknown
parameters.
Standard Error
When the standard deviation of a statistic is estimated from data,
the result is called the standard error of the statistic. The standard
error of the sample mean x̄ is √sn .
Travel time to work
A study of commuting times reports the travel times to work of a
random sample of 1000 employed adults. The mean is x̄ = 49.2
minutes and the standard deviation is s = 63.9 minutes. What is
the standard error of the mean?
Solution
The standard error of the mean is
63.9
s
√ =√
= 2.0207 minutes
n
10000
The one-sample t statistic and the t distributions
Draw an SRS of size n from a large population that has the
Normal distribution with mean µ and standard deviation σ. The
one-sample t statistic
t∗ =
x̄ − µ
√
s/ n
has the t distribution with n − 1 degrees of freedom.
The t distributions
I
The density curves of the t distributions are similar in shape
to the Standard Normal curve. They are symmetric about 0,
single-peaked, and bell-shaped.
I
The spread of the t distributions is a bit greater than of the
Standard Normal distribution. The t distributions have more
probability in the tails and less in the center than does the
Standard Normal. This is true because substituting the
estimate s for the fixed parameter σ introduces more variation
into the statistic.
I
As the degrees of freedom increase, the t density curve
approaches the N(0, 1) curve ever more closely. This happens
because s estimates σ more accurately as the sample size
increases. So using s in place of σ causes little extra variation
when the sample is large.
0.4
Density curves
0.0
0.1
0.2
0.3
Std. Normal
t(2)
t(9)
-4
-2
0
2
4
0.4
Density curves
0.0
0.1
0.2
0.3
Std. Normal
t(29)
-4
-2
0
2
4
0.4
Density curves
0.0
0.1
0.2
0.3
Std. Normal
t(49)
-4
-2
0
2
4
Critical values
Use Table C or software to find
a) the critical value for a one-sided test with level α = 0.05 based
on the t(4) distribution.
b) the critical value for 98% confidence interval based on the t(26)
distribution.
Solution
a) t ∗ = 2.132
b) t ∗ = 2.479
More critical values
You have an SRS of size 30 and calculate the one-sample
t-statistic. What is the critical value t ∗ such that
a) t has probability 0.025 to the right of t ∗ ?
b) t has probability 0.75 to the left of of t ∗ ?
Solution
Here, df = 30 − 1 = 29.
a) t ∗ = 2.045
b) t ∗ = 0.683
The one-sample t confidence interval
Draw an SRS of size n from a large population having unknown
mean µ. A level C confidence interval for µ is
s
x̄ ± t ∗ √
n
where t ∗ is the critical value for the t(n − 1) density curve with
area C between −t ∗ and t ∗ . This interval is exact when the
population distribution is Normal and is approximately correct for
large n in other cases.
Critical values
What critical value t ∗ from Table C would you use for a confidence
interval for the mean of the population in each of the following
situations?
a) A 95% confidence interval based on n = 12 observations.
b) A 99% confidence interval from an SRS of 18 observations.
c) A 90% confidence interval from a sample of size 6.
Solution
a) df = 12 − 1 = 11, so t ∗ = 2.201.
b) df = 18 − 1 = 17, so t ∗ = 2.898.
c) df = 6 − 1 = 5, so t ∗ = 2.015.
Ancient air
The composition of the earth’s atmosphere may have changed over
time. To try to discover the nature of the atmosphere long ago, we
can examine the gas in bubbles inside ancient amber. Amber is
tree resin that has hardened and been trapped in rocks. The gas in
bubbles within amber should be a sample of the atmosphere at the
time the amber was formed. Measurements on specimens of amber
from the late Cretaceous era (75 to 95 million years ago) give
these percents of nitrogen:
63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0
Assume (this is not yet agreed on by experts) that these
observations are an SRS from the late Cretaceous atmosphere. Use
a 90% confidence interval to estimate the mean percent of
nitrogen in ancient air (Our present-day atmosphere is about
78.1% nitrogen).
Solution
µ = mean percent of nitrogen in ancient air. We will estimate µ
with a 90% confidence interval.
With x̄ = 59.5888, s = 6.2552, and t ∗ = 1.860 (df = 9 − 1 = 8),
the 90% confidence interval for µ is
6.2552
√
59.5888 ± 1.860
9
59.5888 ± 3.8782
55.7106 to 63.4670
The one-sample t test
Draw an SRS of size n from a large population having unknown
mean µ. To test the hypothesis H0 : µ = µ0 , compute the
one-sample t statistic
t∗ =
x̄ − µ0
√
s/ n
In terms of a variable T having the t(n − 1) distribution, the
P-value for a test of H0 against
Ha : µ > µ0 is P(T ≥ t ∗ ).
Ha : µ < µ0 is P(T ≤ t ∗ ).
Ha : µ 6= µ0 is 2P(T ≥ |t ∗ |).
These P-values are exact if the population distribution is Normal
and are approximately correct for large n in other cases.
Is it significant?
The one-sample t statistic for testing
H0 : µ = 0
Ha : µ > 0
from a sample of n = 20 observations has the value t ∗ = 1.84.
a) What are the degrees of freedom for this statistic?
b) Give the two critical values t from Table C that bracket t ∗ .
What are the one-sided P-values for these two entries?
c) Is the value t ∗ = 1.84 significant at the 5% level? Is it
significant at the 1% level?
d) (Optional) If you have access to suitable technology, give the
exact one-sided P-value for t ∗ = 1.84?
Solution
a) df = 20 -1 = 19.
b) t ∗ = 1.84 is bracketed by t = 1.729 (with right-tail probability
0.05) and t = 2.093 (with right-tail probability 0.025). Hence,
because this is a one-sided significance test,
0.025 < P-value < 0.05.
c) This test is significant at the 5% level because the
P-value < 0.05. It is not significant at the 1% level because the
P-value > 0.01.
d) From TI-84, tcdf(1.84,1000,19), P-value = 0.0407.
Is it significant?
The one-sample t statistic from a sample of n = 15 observations
for the two-sided test of
H0 : µ = 64
Ha : µ 6= 64
has the value t ∗ = 2.12.
a) What are the degrees of freedom for t ∗ ?
b) Locate the two-critical values t from Table C that bracket t ∗ .
What are the two-sided P-values for these two entries?
c) is the value t ∗ = 2.12 statistically significant at the 10% level?
At the 5% level?
d) (Optional) If you have access to suitable technology, give the
exact two-sided P-value for t ∗ = 2.12.
Solution
a) df = 15 -1 = 14.
b) t ∗ = 2.12 is bracketed by t = 1.761 (with two-tail probability
0.10) and t = 2.145 (with two-tail probability 0.05). Hence,
because this is a two-sided significance test, 0.05 < P-value < 0.10.
c) This test is significant at the 10% level because the
P-value < 0.10. It is not significant at the 5% level because the
P-value > 0.05.
d) From TI-84, tcdf(2.12,1000,19) = 0.0261,
P-value = 2(0.0261) = 0.0522.
Ancient air, continued
Do the data of Exercise 18.7 (see above) give good reason to think
that the percent of nitrogen in the air during the Cretaceous era
was different from the present 78.1%? Carry out a test of
significance at the 5% significance level.
Solution
Is there evidence that the percent of nitrogen in ancient air was
different from the present 78.1%?
1. State hypotheses. H0 : µ = 78.1% vs Ha : µ 6= 78.1%.
x̄−µ
√
√ 0 = 59.5888−78.1
= −8.8778
2. Test statistic. t ∗ = σ/
n
6.2553/ 9
3. P-value. For df = 8, this is beyond anything shown in Table C,
so P-value < 0.001 (TI -84 gives 0.00002).
4. Conclusion. We have very strong evidence (P-value < 0.001)
that Cretaceous air is different from nitrogen than modern air.
Matched pairs t procedures
To compare the responses to the two treatments in a matched
pairs design, find the difference between the responses within each
pair. Then apply the one-sample t procedures to these differences.
Genetic engineering for cancer treatment
Here’s a new idea for treating advanced melanoma, the most
serious kind of skin cancer. Genetically engineer white blood cells
to better recognize and destroy cancer cells, then infuse these cells
into patients. The subjects in a small initial study were 11 patients
whose melanoma had not responded to existing treatments. One
question was how rapidly the new cells would multiply after
infusion, as measured by the doubling time in days. Here are the
doubling times:
1.4 1.0 1.3 1.0 1.3 2.0 0.6 0.8 0.7 0.9 1.9
a) Examine the data. Is it reasonable to use the t procedures?
b) Give a 90% confidence interval for the mean doubling time. Are
you willing to use this interval to make an inference about the
mean doubling time in a population of similar patients?
Solution
a) The stemplot does not show any severe evidence of
non-Normality, so t procedures should be safe.
0
1
1
2
6
0
9
0
7
0
8
3
9
3
4
Solution
b) With x̄ = 1.1727 days, s = 0.4606 days, and t ∗ = 1.812 (df =
10), the 90% confidence interval is
0.4606
1.1727 ± 1.812 √
11
1.1727 ± 0.2516
0.9211 to 1.4243 days
Solution
There is no indication that the sample represents an SRS of all
patients whose melanoma has not responded to existing
treatments, so inferring to the population of similar patients may
not be reasonable.
Genetic engineering for cancer treatment, continued
Another outcome in the cancer experiment described above is
measured by a test for the presence of cells that trigger an immune
response in the body and so may help fight cancer. Here are data
for the 11 subjects: counts of active cells per 100,000 cells before
and after infusion of the modified cells. The difference (after minus
before) is the response variable.
Data
Before
14
0
1
0
0
0
0
20
1
6
0
After
41
7
1
215
20
700
13
530
35
92
108
Difference
27
7
0
215
20
700
13
510
34
86
108
Difference/10
2.7
0.7
0
21.5
2
70
1.3
51
3.4
8.6
10.8
Genetic engineering for cancer treatment, continued
a) Examine the data. Is it reasonable to use the t procedures?
b) If your conclusion in part a) is ”Yes”, do the data give
convincing evidence that the count of active cells is higher after
treatment?
Solution
a) The stem plot of differences shows an extreme right skew, and
one or two high outliers. The t procedures should not be used.
0
1
2
3
4
5
6
7
0
0
1
1
0
0
1
2
2
3
8
Solution
b) 1. State hypotheses. H0 : µ = 0 vs Ha : µ > 0.
x̄−µ
√
√ 0 = 156.3636−0
= 2.2134
2. Test statistic. t ∗ = σ/
n
234.2952/ 11
3. P-value. For df = 10, using Table C we have that:
1.812 < t ∗ < 2.228. Which implies that: 0.025 < P-value < 0.05.
TI -84 gives 0.0256.
4. Conclusion. We would have strong evidence against H0
(P-value < 0.05). We would conclude that the count of active cells
is higher after treatment.
Robust Procedures
A confidence interval or significance test is called robust if the
confidence level or P-value does not change very much when the
conditions for use of the procedure are violated.
Using t procedures
I
Except in the case of small samples, the condition that the
data are an SRS from the population of interest is more
important than the condition that the population distribution
is Normal.
I
Sample size less than 15: Use t procedures if the data appear
close to Normal (roughly symmetric single peak, no outliers).
If the data are clearly skewed or if outliers are present, do not
use t.
I
Sample size at least 15: The t procedures can be used except
in the presence of outliers or strong skewness.
I
Large samples: The t procedures can be used even for clearly
skewed distributions when the sample is large, roughly n ≥ 40.
CHAPTER 19
TWO-SAMPLE PROBLEMS
Two-sample problems
I
The goal of inference is to compare the responses to two
treatments or to compare the characteristics of two
populations.
I
We have a separate sample from each treatment or each
population.
Conditions for inference comparing two means
I
We have two SRSs, from two distinct populations. The
samples are independent. That is, one sample has no influence
on the other. Matching violates independence, for example.
We measure the same response variable for both samples.
I
Both populations are Normally distributed. The means and
standard deviations of the populations are unknown. In
practice, it is enough that the distributions have similar
shapes and that the data have no strong outliers.
The Two-Sample Procedures
Draw an SRS of size n1 from a Normal population with unknown
mean µ1 , and draw and independent SRS of size n2 from another
Normal population with unknown mean µ2 . A confidence interval
for µ1 − µ2 is given by
s
s12
s2
+ 2
(x̄1 − x̄2 ) ± t ∗
n1 n2
Here t ∗ is the critical value for the t(k) density curve with area C
between −t ∗ and t ∗ . The degrees of freedom k are equal to the
smaller of n1 − 1 and n2 − 1.
The Two-Sample Procedures
To test the hypothesis H0 : µ1 = µ2 , calculate the two-sample t
statistic
x̄1 − x̄2
t∗ = q 2
s1
s22
n1 + n2
and use P-values or critical values for the t(k) distribution.
Degrees of freedom (Option 1)
Option 1. With software, use the statistic t with accurate critical
values from the approximating t distribution.
The distribution of the two-sample t statistic is very close to the t
distribution with degrees of freedom df given by
s22
s12
n1 + n2
2 2 s
df = 1
n1 −1
1
n1
+
2
1
n2 −1
2 2
s2
n2
This approximation is accurate when both sample sizes n1 and n2
are 5 or larger.
Degrees of freedom (Option2)
Option 2. Without software, use the statistic t with critical values
from the t distribution with degrees of freedom equal to the
smaller of n1 − 1 and n2 − 1. These procedures are always
conservative for any two Normal populations.
Logging in the rain forest
”Conservationists have despaired over destruction of tropical rain
forest by logging, clearing, and burning”. These words begin a
report on a statistical study of the effects of logging in Borneo.
Here are data on the number of tree species in 12 unlogged forest
plots and 9 similar plots logged 8 years earlier:
Unlogged: 22 18 22 20 15 21 13 13 19 13 19 15
Logged : 17 4 18 14 18 15 15 10 12
Does logging significantly reduce the mean number of species in a
plot after 8 years? State the hypotheses and do a t test. Is the
result significant at the 5% level?
Solution
Does logging significantly reduce the mean number of species in a
plot after 8 years?
1. State hypotheses. H0 : µ1 = µ2 vs Ha : µ1 > µ2 , where µ1 is
the mean number of species in unlogged plots and µ2 is the mean
number of species in plots logged 8 years earlier.
2. Test statistic.t ∗ = rx̄12−x̄2 2 = 2.1140 (x̄1 = 17.5, x̄2 = 13.6666 ,
s
s
1+ 2
n1
n2
s1 = 3.5290, s2 = 4.5, n1 = 12 and n2 = 9)
3. P-value. Using Table C, we have df = 8, and
0.025 < P-value < 0.05.
Using TI-84, we have df = 14.793443, and P-value = 0.02595.
4. Conclusion. Since P-value < 0.05, we reject H0 . There is strong
evidence that the mean number of species in unlogged plots is
greater than that for logged plots 8 year after logging.
Logging in the rainforest, continued
Use the data from the previous exercise to give a 99% confidence
interval for the difference in mean number of species between
unlogged and logged plots.
Solution
1. Find x̄1 − x̄2 . From what we did earlier:
x̄1 − x̄2 = 17.5 − 13.6666 = 3.8334
2. Find SE = Standard Error. We already know that: s1 = 3.5290,
s2 = 4.5, n1 = 12 and n2 = 9
s
r
s22
s12
3.52902 4.52
+
=
+
= 1.8132
SE =
n1 n2
12
9
3. Find m = t ∗ SE . From Table C, we have df = 8 and 99%
confidence level, then t ∗ = 3.355. Hence,
m = (3.355)(1.8132) = 6.0832.
4. Find Confidence Interval.
x̄1 − x̄2 ± t ∗ SE = 3.8334 ± 6.0832 = −2.2498 to 9.9166.
TI 84 gives a 99% confidence interval of −1.52 to 9.1871 species,
using df = 14.793443.
Alcohol and zoning out
Healthy men aged 21 to 35 were randomly assigned to one of two
groups: half received 0.82 grams of alcohol per kilogram of body
weight; half received a placebo. Participants were then given 30
minutes to read up to 34 pages of Tolstoy’s War and Peace
(beginning at chapter 1, with each page containing approximately
22 lines of text). Every two to four minutes participants were
prompted to indicate whether they were ”zoning out”. The
proportion of time participants indicated they were zoning out was
recorded for each subject. The table below summarizes data on the
proportion of episodes of zoning out. (The study report gave the
√
standard error of the mean s/ n, abbreviated as SEM, rather than
the standard deviation s.)
Alcohol and zoning out
Group
Alcohol
Placebo
n
25
25
x̄
0.25
0.12
SEM
0.05
0.03
a) What are the two sample standard deviations?
b) What degrees of freedom does the conservative Option 2 use for
two-sample t procedures for these samples?
c) Using Option 2, give a 90% confidence interval for the mean
difference between the two groups.
Solution
a) Call group 1 the Alcohol group,and group 2 the Placebo group.
√
√
Then, because
SEM = s/ n, we have s = SEM n. Hence,
√
s1 = 0.05√25 = 0.5(5) = 0.25 and
s2 = 0.03 25 = 0.03(5) = 0.15.
b) Using the conservative option 2,
df = min{25 − 1, 25 − 1} = min{24,
= 24.
q 24}
√
s12
s2
c) Here, with n1 = n2 = 25, SE = n1 + n22 = 0.0034 = 0.0583.
With df = 24, we have t ∗ = 1.711, and a 90% confidence interval
for the mean difference in proportions is given by
0.25 − 0.12 ± 1.711(0.0583) = 0.13 ± 0.0997, that is, from 0.0303
to 0.2297.
Stress and weight in rats
In a study of the effects of stress on behavior in rats, 71 rats were
randomly assigned to either a stressful environment or a control
(non stressful) environment. After 21 days, the change in weight
(in grams) was determined for each rat. The table below
summarizes data on weight gain. (The study report gave the
√
standard error of the mean s/ n, abbreviated as SEM, rather than
the standard deviation s).
Stress and weight in rats
Group
Stress
No stress
n
20
51
x̄
26
32
SEM
3
2
a) What are the standard deviations for the two groups?
b) What degrees of freedom does the conservative Option 2 use for
the two-sample procedures for these data?
c) Test the null hypothesis of no difference between the two group
means against the two-sided alternative at the 5% significance
level. Use the degrees of freedom from part b).
Solution
a) Call group 1 the Stress group,and group 2 the No stress group.
√
√
have s = SEM n. Hence,
Then, √
because SEM = s/ n, we √
s1 = 3 20 = 13.4164 and s2 = 2 51 = 14.2828.
b) Using the conservative option 2,
df = min{20 − 1, 51 − 1} = min{19, 50} = 19.
c) 1. Set hypotheses. H0 : µ1 = µ2 vs Ha : µ1 6= µ2
2. Calculate
statistic. With n1 = 20 and n2 = 51,
q 2 test
√
s1
s22
−x¯2
= −1.6641.
SE = n1 + n2 = 12.9999 = 3.6055, t ∗ = x¯1SE
3. P-value. With df = 19, using Table C, 0.10 < P-value < 0.20.
Using TI-84 (2-SampTTest), P-value = 0.1045
4. Conclusion. Since P-value > 0.05 we CAN’T reject H0 . There is
little evidence in support of a conclusion that mean weights of rats
in stressful environments differ from those of rats without stress.
CHAPTER 20
INFERENCE ABOUT A POPULATION PROPORTION
Problem
A market research consultant hired by the Pepsi-Cola Co. is
interested in determining the proportion of UNM students who
favor Pepsi-Cola over Coke Classic. A random sample of 100
students shows that 40 students favor Pepsi over Coke. Use this
information to construct a 95% confidence interval for the
proportion of all students in this market who prefer Pepsi.
Bernoulli Distribution
xi =
1 i-th person prefers Pepsi
0 i-th person prefers Coke
µ = E (xi ) = p
p
σ 2 = V (xi ) = p(1 − p), i.e. σ = p(1 − p)P
Let p̂ be our estimate of p. Note that p̂ = ni=1 xi = x̄. If n is
”big”, by the Central Limit Theorem,
x̄ is roughly
we
q know that:
N µ, √σn , that is, p̂ is roughly N p, p(1−p)
n
Sampling distribution of a sample proportion
Draw an SRS of size n from a large population that contains
proportion p of successes. Let p̂ be the sample proportion of
successes,
p̂ =
number of successes in the sample
n
Then:
I
The mean of the sampling distribution of p̂ is p.
I
The
q standard deviation of the sampling distribution is
p(1−p)
.
n
I
As the sample size increases, the sampling distribution of p̂
becomes approximately p
Normal. That is, for large n, p̂ has
approximately the N(p, p(1 − p)/n).
Large-sample confidence interval for a population
proportion
Draw an SRS of size n from a large population that contains an
unknown proportion p of successes. An approximate level C
confidence interval for p is
r
p̂(1 − p̂)
p̂ ± z ∗
n
∗
where z is the critical value for the standard Normal density curve
with area C between −z ∗ and z ∗ .
Use this interval only when the numbers of successes and failures
in the sample are both 15 or greater.
Problem
A survey of 611 office workers investigated telephone answering
practices, including how often each office worker was able to
answer incoming telephone calls and how often incoming telephone
calls went directly to voice mail. A total of 281 office workers
indicated that they never need voice mail and are able to take
every telephone call.
a. What is the point estimate of the proportion of the population
of office workers who are able to take every telephone call?
b. At 90% confidence, what is the margin of error?
c. What is the 90% confidence interval for the proportion of the
population of office workers who are able to take every telephone
call?
Solution
p = proportion of the population of office workers who are able to
take every telephone call.
a . p̂ = 281
611 = 0.46
q
q
p̂(1−p̂)
∗
= 1.645 (0.46)(0.54)
=
b. Margin of error = z
n
611
1.645(0.0201)
=
0.0330
q
c. p̂ ± z ∗ p̂(1−p̂)
n
0.46 ± .0330
From 0.4270 to 0.4930.
We are 90% confident that the proportion of the population of
office workers who are able to take every phone call lies between
42.70% and 49.30%.
Computer/Internet-based crime
With over 50% of adults spending more than an hour a day on the
internet, the number experiencing computer-or Internet- based
crime continues to rise. A survey in 2010 of a random sample of
1025 adults, aged 18 and older, reached by random digit dialing
found 113 adults in the sample who said that they or a household
member had been the victim of a computer or Internet crime on
their home computer in the past year. Give the 99% confidence
interval for the proportion p of all households that have
experienced computer or Internet crime during the year before the
survey was conducted.
Solution
p = proportion of all households that have experienced computer
or Internet crime during the year before the survey was conducted.
Step 1. Find p̂.
113
= 0.1102.
p̂ = number of successes = 1025
sample size
Step
of error
q 2. Find m = margin
q
z ∗ p̂(1−p̂)
= 2.576 0.1102(1−0.1102)
= 2.576(0.0097) = 0.0249
n
1025
Step 3. Find confidence interval, i.e. p̂ − m and p̂ + m.
p̂ − m = 0.1102 − 0.0249 = 0.0853
p̂ + m = 0.1102 + 0.0249 = 0.1351
Based on this sample, we are 99% confident that between 8.53%
and 13.51% of Internet users were victims of computer or Internet
crime during the year before this survey was taken.
Sample Size for desired margin of error
The level C confidence interval for a population proportion p will
have margin of error approximately equal to a specified value m
when the sample size is
n=
z∗
m
2
p ∗ (1 − p ∗ )
where p ∗ is a guessed value for the sample proportion. The margin
of error will always be less than or equal to m if you take the guess
p ∗ to be 0.5.
Problem
The percentage of people not covered by health care insurance in
2003 was 15.6%. A congressional committee has been charged
with conducting a sample survey to obtain more current
information.
a. What sample size would you recommend if the committee’s goal
is to estimate the current proportion of individuals without health
care insurance with a margin of error of 0.03? Use a 95%
confidence level.
b. Repeat part a) assuming that you have no prior information (i.e.
p ∗ = 0.5).
c. Repeat part a) using a 99% confidence level.
d. Repeat part c) assuming that you have no prior information (i.e.
p ∗ = 0.5).
Solution
a. n =
b. n =
c. n =
c. n =
z∗ 2 ∗
p (1 − p ∗ ) =
m
z∗ 2 ∗
p (1 − p ∗ ) =
m
∗
2
z
p ∗ (1 − p ∗ ) =
m
∗
2
z
p ∗ (1 − p ∗ ) =
m
1.96 2
(0.156)∗ (1 − 0.156) = 563
0.03
1.96 2
(0.5)∗ (1 − 0.5) = 1068
0.03
2
2.576
(0.156)∗ (1 − 0.156) = 971
0.03
2
2.576
(0.5)∗ (1 − 0.5) = 1844
0.03
0.15
0.05
0.10
p*=0.5
0.00
p*(1-p*)
0.20
0.25
Graph of p ∗ (1 − p ∗ )
0.0
0.2
0.4
0.6
p*
0.8
1.0
Canadians and doctor-assisted suicide
A Gallup Poll asked a sample of Canadian adults if they thought
the law should allow doctors to end the life of a patient who is in
great pain and near death if the patient makes a request in writing.
The poll included 270 people in Quebec, 221 of whom agreed that
doctor-assisted suicide should be allowed.
a) What is the margin of error of the large-sample 95% confidence
interval for the proportion of all Quebec adults who would allow
doctor-assisted suicide?
b) How large a sample is needed to get the common ±3
percentage point margin of error? Use the previous sample as a
pilot study to get p ∗ .
Solution
q
a) We find that p̂ =
= 0.8185 and SEp̂ = p̂(1−p̂)
= 0.0234.
n
Hence, the margin of error for 95% confidence is
(1.96)(0.0234) = 0.0458.
b) For a ±0.03 margin of error, we need
2
(0.8185)(1 − 0.8185) = 634.1105. Round this up in
n = 1.96
0.03
order to obtain a required sample size of 635.
221
270
Significance tests for a proportion
Draw an SRS of size n from a large population that contains an
unknown proportion p of successes. To test the hypothesis
H0 : p = p0 , compute the z ∗ statistic
p̂ − p0
z∗ = q
p0 (1−p0 )
n
Find P-values from the standard Normal distribution.
Use this test when the sample size n is so large that both np0 and
n(1 − p0 ) are 10 or more.
P-values
To test the hypothesis H0 : p = p0 , compute the z ∗ statistic
p̂ − p0
z∗ = q
p0 (1−p0 )
n
In terms of a variable Z having the standard Normal distribution,
the approximate P-value for a test of H0 against
Ha : p > p0 is P(Z > z ∗ )
Ha : p < p0 is P(Z < z ∗ )
Ha : p 6= p0 is 2P(Z > |z ∗ |)
Problem
A study found that, in 2005, 12.5% of U.S. workers belonged to
unions. Suppose a sample of 400 U.S. workers is collected in 2006
to determine whether union efforts to organize have increased
union membership.
a. Formulate the hypotheses that can be used to determine
whether union membership increased in 2006.
b. If the sample results show that 52 of the workers belonged to
unions, what is the p-value for your hypothesis test?
c. At α = 0.05, what is your conclusion?
Solution
p = proportion of all U.S. workers who belonged to a union in
2006.
a.H0 : p = 0.125 vs Ha : p > 0.125
52
= 0.13
b . p̂ = 400
p̂−p0
∗
q
z = p (1−p ) = q0.13−0.125
= 0.30
(0.125)(0.875)
0
0
n
400
Using Table A,
P-value = P(Z > z ∗ ) = P(Z > 0.30) = 1 − 0.6179 = 0.3821
c. P-value > 0.05, do not reject H0 . We cannot conclude that
there was an increase in union membership.
Problem
A study by Consumer Reports showed that 64% of supermarket
shoppers believe supermarket brands to be as good as national
name brands. To investigate whether this result applies to its own
product, the manufacturer of a national name-brand ketchup asked
a sample of shoppers whether they believed that supermarket
ketchup was as good as the national brand ketchup.
a. Formulate the hypotheses that could be used to determine
whether the percentage of supermarket shoppers who believe that
the supermarket ketchup was as good as the national brand
ketchup differed from 64%.
b. If a sample of 100 shoppers showed 52 stating that the
supermarket brand was as good as the national brand, what is the
p-value?
c. At α = 0.05, what is your conclusion?
Solution
p = proportion of all shoppers who believe supermarket brands to
be as good as this particular national brand ketchup.
a.H0 : p = 0.64 vs Ha : p 6= 0.64
52
= 0.52
b . p̂ = 100
p̂−p
∗
0
z = q p (1−p ) = q0.52−0.64
= −2.50
(0.64)(0.36)
0
0
n
100
Using Table A, P-value = 2P(Z > |z ∗ |) = 2P(Z > | − 2.50|) =
2P(Z > 2.50) = 2(0.0062) = 0.0124
c. P-value < 0.05, reject H0 . Proportion differs from the reported
0.64.
Problem
The National Center for Health Statistics released a report that
stated 70% of adults do not exercise regularly. A researcher decided
to conduct a study to see whether the claim made by the National
Center for Health Statistics differed on a state-by-state basis.
a. State the null and alternative hypotheses assuming the intent of
the researcher is to identify states that differ from 70% reported by
the National Center for Health Statistics.
b. At α = 0.05, what is the research conclusion for the following
states?: Wisconsin: 252 of 350 adults did not exercise regularly.
California: 189 of 300 adults did not exercise regularly.
Solution (Wisconsin)
p = proportion of all adults in the state of Wisconsin that do not
exercise regularly.
a.H0 : p = 0.70 vs Ha : p 6= 0.70
b. (Wisconsin) p̂ = 252
350 = 0.72
0.72−0.70
0
q
z ∗ = q p̂−p
=
= 0.82
p (1−p )
(0.70)(0.30)
0
0
n
350
Using Table A, P-value = 2P(Z > |z ∗ |) = 2P(Z > |0.82|) =
2P(Z > 0.82) = 2(0.2061) = 0.4122
c. P-value > 0.05, do not reject H0 . We don’t have evidence to
claim that Wisconsin is one of those states where the proportion of
adults that do not exercise regularly differs from 70%.
Solution (California)
p = proportion of all adults in the state of California that do not
exercise regularly.
a.H0 : p = 0.70 vs Ha : p 6= 0.70
b. (California) p̂ = 189
300 = 0.63
0.63−0.70
0
q
z ∗ = q p̂−p
=
= −2.65
p (1−p )
(0.70)(0.30)
0
0
n
300
Using Table A, P-value = 2P(Z > |z ∗ |) = 2P(Z > | − 2.65|) =
2P(Z > 2.65) = 2(1 − 0.9960) = 0.0080
c. P-value < 0.05, we reject H0 . We have strong evidence to claim
that California’s proportion of adults that do not exercise regularly
differs from 70%.
CHAPTER 23
TWO CATEGORICAL VARIABLES: THE CHI-SQUARE TEST
Problem
A sample of 70 girls and boys was taken at random from a
population of children (perhaps of a particular age of interest), and
then the numbers of right-handed boys, right-handed girls,
left-handed boys, and left-handed girls were recorded as shown
below:
Left-handed
Right-handed
Total
Girls
12
24
36
Boys
6
28
34
Total
18
52
70
Is there evidence that, in the sampled population, handedness is
independent of sex? (Use α = 0.05)
Step 1. State Hypotheses
H0 : In the sampled population, there is NO relationship between
handedness and sex.
Ha : In the sampled population, there is a relationship between
handedness and sex.
Step 2. Compute test statistic.
Draw an SRS from a large population and make a two-way table of
the sample counts for two categorical variables. To test the null
hypotheses H0 that there is no relationship between the row and
column variables in the population, calculate the chi-square
statistic
X2 =
X ( observed count - expected count )2
expected count
The sum is over all cells in the table.
The chi-square test rejects H0 when χ2 is large. Sofware finds
P-values from a chi-square distribution.
Step 2. (cont.)
Expected Counts.
P(right-handed) = 52
P(left-handed) = 18
70
70
Expected number of left-handed girls =
(36)(18)
number of girls × P(left-handed) = (36)( 18
= 9.26.
70 ) =
70
Expected number of right-handed girls =
(36)(52)
= 26.74.
number of girls × P(right-handed) = (36)( 52
70 ) =
70
Expected number of left-handed boys =
(34)(18)
number of boys × P(left-handed) = (34)( 18
= 8.74.
70 ) =
70
Expected number of right-handed boys =
52
number of boys × P(right-handed) = (34)( 70
) = (34)(52)
= 25.26.
70
Expected Counts
The expected counts in any cell of a two-way table when H0 is true
is:
expected count =
row total x column total
table total
Table of Expected Counts
Left-handed
Right-handed
Total
Girls
9.26
26.74
36
Boys
8.74
25.26
34
Total
18
52
70
X2 =
(12−9.26)2
9.26
+
(24−26.74)2
26.74
+
(6−8.74)2
8.74
+
(28−25.26)2
25.26
X 2 = 0.8107 + 0.2807 + 0.8589 + 0.2972 = 2.2475
(Using TI-84, X 2 = 2.2523).
Step 3. Find P-value
d.f. = (r − 1)(c − 1) = (2 − 1)(2 − 1) = 1
Using Table D, 2.07 < X 2 = 2.2475 < 2.71 which implies that
0.10 < P-value < 0.15. (Using TI-84,P-value = 0.1334.)
Step 4. Conclusion
Since P-value > 0.10 > 0.05 = α, we CAN’T reject H0 . We
conclude that there is NO relationship between handedness and
sex.
Example
Suppose the Federal Correction Agency wants to investigate the
following question: Does a male released from federal prison make
better adjustment to civilian life if he returns to his hometown or if
he goes elsewhere to live? To put it another way, is there a
relationship between adjustment to civilian life and place of
residence after release from prison?
The agency’s psychologists interviewed 200 randomly selected
former prisoners. Using a series of questions, the psychologists
classified the adjustment of each individual to civilian life as being
outstanding, good, fair, or unsatisfactory. The counts are given in
the following contingency table.
Examine the hypothesis that there is no relationship between
adjustment to civilian life and place of residence after release from
prison. Test at the α = 0.01 level.
Table of observed counts
Hometown
Not hometown
Total
Outstanding
27
13
40
Good
35
15
50
Fair
33
27
60
Unsatisfactory
25
25
50
Total
120
80
200
Step 1. State hypotheses
H0 : There is NO relationship between adjustment to civilian life
and where the individual lives after being released from prison.
Ha : There is a relationship between adjustment to civilian life and
where the individual lives after being released from prison.
Table of EXPECTED counts
Hometown
Not hometown
Total
Outstanding
24
16
40
Good
30
20
50
Fair
36
24
60
Unsatisfactory
30
20
50
Total
120
80
200
Step 2. Compute test statistic.
2
2
(27−24)2
+ (35−30)
+ (33−36)
24
30
36
2
2
(15−20)2
+ (27−24)
+ (25−20)
20
24
20
X2 =
+
(25−30)2
30
+
(13−16)2
16
+
X 2 = 0.375 + 0.833 + 0.250 + 0.833 + 0.563 + 1.250 + 0.375 + 1.250
X 2 = 5.729
(Using TI-84, X 2 = 5.7291).
Step 3. Find P-value
d.f. = (r − 1)(c − 1) = (2 − 1)(4 − 1) = 3
Using Table D, 5.32 < X 2 = 5.729 < 6.25 which implies that
0.10 < P-value < 0.15. (Using TI-84,P-value = 0.1255.)
Step 4. Conclusion
Since P-value > 0.10 > 0.01 = α, we CAN’T reject H0 . We
conclude that there is NO relationship between adjustment to
civilian life and where the prisoner resides after being released from
prison. For the Federal Correction Agency’s advisement program,
adjustment to civilian life is not related to where the ex-prisoner
lives after being released.
Cell counts required for the chi-square test
You can safely use the chi-square test with P-values from the
chi-square distribution when no more than 20% of the expected
counts are less than 5 and all individual expected counts are 1 or
greater. In particular, all four expected counts in a 2 × 2 table
should be 5 or greater.
Majors for men and women in business
A study of the career plans of young women and men sent
questionnaires to all 722 members of the senior class in the College
of Business Administration at the University of Illinois. One
question asked which major within the business program the
student had chosen. Here are the data from the students who
responded:
Accounting
Administration
Economics
Finance
Total
Female
68
91
5
61
225
Male
56
40
6
59
161
Total
124
131
11
120
386
This is an example of a single sample classified according to two
categorical variables (gender and major).
Majors for men and women in business (cont.)
a) Test the null hypothesis that there is no relationship between
the gender of students and their choice of major. Give a P-value
and state your conclusion(Use α = 0.05.)
b) Verify that the expected cell counts satisfy the requirement for
use of chi-square.
c) Which two cells have the largest terms in the chi-square
statistic? How do observed and expected counts differ in these
cells?
Solution
a) Step 1. State Hypotheses.
H0 : There is NO relationship between gender and choice of major.
Ha : There is a relationship between gender and choice of major.
Solution
Expected counts.
Accounting
Administration
Economics
Finance
Total
Female
72.28
76.36
6.41
69.95
225
Male
51.72
54.64
4.59
50.05
161
Total
124
131
11
120
386
Solution
Step 2. Compute test statistic.
2
2
+ (56−51.72)
+
X 2 = (68−72.28)
72.28
51.72
(5−6.41)2
6.41
+
(6−4.59)2
4.59
+
2
(91−76.36)2
+ (40−54.64)
76.36
54.64
2
(61−69.95)2
+ (59−50.05)
69.95
50.05
+
X 2 = 0.253 + 0.354 + 2.807 + 3.923 + 0.311 + 0.434 + 1.145 + 1.600
X 2 = 10.827
Solution
Step 3. Find P-value.
d.f. = (r − 1)(c − 1) = (2 − 1)(4 − 1) = 3
Using Table D, 9.84 < X 2 = 10.827 < 11.34 which implies that
0.01 < P-value < 0.02. (Using TI-84,P-value = 0.0127.)
Solution
Step 4. Conclusion.
Since P-value < 0.05, we reject H0 . We have fairly strong evidence
that gender and choice of major are related.
b) One expected count is less than 5, which is only one-eight
(12.5%) of the counts in the table, so the chi-square procedure is
acceptable.
c) The largest chi-square components are the two from the
”Administration” row. Many more women than we expect (91
actual, 76.36 expected) chose this major, whereas only 40 men
chose this (54.64 expected).
The Chi-square distributions
The chi-square distributions are a family of distributions that take
only positive values and are skewed to the right. A specific
chi-square distribution is specified by giving its degrees of freedom.
The chi-square test for a two-way table with r and c columns uses
critical values from the chi-square distribution with (r-1)(c-1)
degrees of freedom. The P-value is the area under the density
curve of this chi-square distribution to the right of the value of the
test statistic.
0.5
Density curves
0.0
0.1
0.2
0.3
0.4
df=1
df=4
df=8
0
5
10
15
20