Download Math 227 Ch 12 notes KEY S16.docx

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Psychometrics wikipedia , lookup

Bootstrapping (statistics) wikipedia , lookup

Foundations of statistics wikipedia , lookup

Taylor's law wikipedia , lookup

Omnibus test wikipedia , lookup

Analysis of variance wikipedia , lookup

Misuse of statistics wikipedia , lookup

Resampling (statistics) wikipedia , lookup

Student's t-test wikipedia , lookup

Transcript
Chapter 12 Inferences on Categorical Data
Ch 12.1 Goodness-of-Fit Test
Objective A : Goodness-of-Fit Test
Example 1: The probabilities of getting an A, B, C or D for a science class at a particular
university are shown below. Determine the expected counts for each outcome if the sample
size is 700.
π‘π‘Ÿπ‘œπ‘π‘Žπ‘π‘–π‘™π‘–π‘‘π‘¦: 𝑝𝑖
Expected counts: 𝐸𝑖
A
0.15
105
B
0.30
210
C
0.35
245
D
0.20
140
Ei ο€½ i ο€½ npi
E1 ο€½ 700 * 0.15 ο€½ 105
E 2 ο€½ 700 * 0.30 ο€½ 210
E3 ο€½ 700 * 0.35 ο€½ 245
E 4 ο€½ 700 * 0.20 ο€½ 140
Note: 𝑝𝑖 = 0.15 + 0.30 + 0.35 + 0.20 = 1
Check: 105 + 210 + 245 + 140 = 700
Example 2:
For example you toss a special rigged coin (binomial since there only two possible outcomes:
heads or tails) four times and the number of heads are counted. There are five possible
outcomes: 0H, 1H, 2H, 3H, or 4H. The seller of this special coin claims a 0.3 probability of
landing on heads each flip. The buyer (who is a statistician) is not sure if he believes the seller.
Therefore he conducts his own experiment.
How was E1 , E2 ,...... being calculated?
P(0 Heads)= P(T) and P(T) and P(T) and P(T) = (0.7)(0.7)(0.7)(0.7) = 0.2401
n = 240.1 + 411.6 + 264 + 75.6 + 8.1 = 1000 (This process was repeated 1000 times.)
𝐸1 = 𝑝1 𝑛 = 0.2401 βˆ— 1000 = 240.1(240 times of the 1000 times resulted in zero heads)
We can get the rest from Statcrunch:
Stat --> Calculator --> Binomial --> Input the following --> Compute
(a) Determine the  2 test statistic.
2 ο€½ οƒ₯
Oi ο€­ Ei 2
Ei
(260 ο€­ 240.1) 2 (400 ο€­ 411.6) 2 (280 ο€­ 264.6) 2 (50 ο€­ 75.6) 2 (10 ο€­ 8.1) 2




240.1
411.6
264.6
75.6
8.1
= 11.987
=
(b) Determine the degrees of freedom.
DF ο€½ k ο€­ 1 ο€½ 5 ο€­ 1 ο€½ 4
(k = 5 since there are 5 possible outcomes)
(c) Use StatCrunch to determine the P ο€­ value.
Stat --> Calculator --> Chi-Square --> Standard -->
The hypothesis tests of this section (categorical data) are always right-tailed;
Input the following.
P ο€­ value = 0.0174 which is unusual and 0.0174 < 0.05 so reject the null hypothesis Ho.
(d) Conclusion
There is sufficient evidence to support the claim that the random variable X is not binomial with
n = 4, p = 0.3. Therefore, the statistician should not buy the coin.
Example 3:
Use StatCrunch to perform the hypothesis testing of Example 2
at the  ο€½ 0.01 level of significance.
(a) Setup
Ho: The random variable X is binomial with n = 4, p = 0.3.
H1: The random variable X is not binomial with n=4, p=0.3.
(b) P ο€­ value
Input Observed Counts in column 1 and Expected Counts in column 2 --> Stat --> Goodness-offit --> Chi-Square test --> Select Var1 for Observed and Var2 for Expected--> Compute
P ο€­ value = 0.0174 (same as before)
Which is low but the significance level is now 0.01 and 0.0174 is not less than 0.01.
Therefore, not unusual at a 0.01 significance level. Can not reject the null.
(c) Conclusion
There is not sufficient to support the claim that the random variable
X is not a binomial with n = 4, p = 0.3. The statistician might want to buy the coin.
The significance level makes a difference!!!
Example 4:
Total = 53+66+38+96+88+59 = 400
a. Set up
Ho: p(brown) = 0.12, p(yellow) = 0.15, p(red) = 0.12, p(blue) = 0.23,
p(orange) = 0.23, p(green) = 0.15
H1: At least one of the proportions is not equal to or different from the
reported claim from the manufacturer.
Expected values by hand (what we would expect if what the company claims is
true):
E(brown) = 0.12*400 = 48, E(yellow) = 0.15*400 = 60, E(red) = 0.12*400 = 48,
E(blue) = 0.23*400 = 92, E(orange) = 0.23*400 = 92, E(green) = 0.15*400 = 60.
X
Observed
Expected
Brown
53
48
Yellow
66
60
Red
38
48
Blue
96
92
Orange
88
92
Green
59
60
b. p-value (from Statcrunch)
Input Observed Counts in column 1 and Expected Counts in column 2--> Stat --> Goodness-of-fit
--> Chi-Square test --> Select Var1 for Observed and select Var2 for Expected --> Compute
P-value (0.613) which is not unusual and 0.613 is not less than 0.05. Cannot reject the null
hypothesis.
c. Conclusion:
There is not sufficient evidence to support the claim that what the manufacture claims is not
true. Thus, the company reports correct proportions.
Ch 12.2 Tests for Independence
Objective A :Tests for Independence
Example 1:
Men
Women
Total
(a) Compute the expected values of each cell under the assumption of
independence.
Pro life
Pro choice
Total
196 (actual)
199
395
239
249
488
435
448
883
By assuming an individual opinion and gender are independent,
(row total)(column total)
(395)(435)
𝐸11 = 883 β‰ˆ 194.6 (expected)
Eο€½
( grand total)
E11 ο€½
(395)( 435)
(395)( 448)
ο€½ 194.592 E12 ο€½
ο€½ 200.408
883
883
E 21 ο€½
(488)( 435)
(488)( 448)
ο€½ 240.408 E 22 ο€½
ο€½ 247.592
883
883
Summarize the observed counts and expected counts in a table where the expected counts are
expressed in a parenthesis.
Gender
Men
Women
Column Total
Pro Life
196 (194.592)
239 (240.408)
435
Pro Choice
199 (200.408)
249 (247.592)
448
Row Total
395
488
883 (Grand Total)
(b) Verify that the requirements for performing a chi-square test of
independence are satisfied.
(1) Are all expected frequencies are greater than or equal to 1? Yes.
(2) No more than 20% of the expected frequencies are less than 5: true.
(c) Determine the  2 test statistic.
 ο€½οƒ₯
2
Oi ο€­ Ei 2
Ei
(196 ο€­ 194.592) 2 (199 ο€­ 200.408) 2 (239 ο€­ 240.408) 2 (249 ο€­ 247.592) 2



194.592
200.408
240.408
247.592
= 0.0374
=
(d) Determine the degrees of freedom.
DF = (r - 1)(c - 1) = (2 - 1)(2 - 1) = 1
(e) Test whether an individual's opinion regarding abortion is independent
of gender at the  ο€½ 0.10 level of significance.
Set up:
Ho: An individual opinion regarding abortion is independent of gender.
H1: An individual opinion regarding abortion is dependent of gender.
Or
Ho: There is no difference between gender and opinion on abortion.
H1: There is a difference between gender and opinion on abortion.
P value: from statcrunch:
Stat --> Calculator --> Chi-Square --> Standard -->
The hypothesis tests of this section are always right-tailed;
Input the following.
P-value = 0.847 which is not unusual and 0.847 is not less the significance level of 0.10. Cannot
reject the null hypothesis.
Conclusion:
There is not enough evidence to support the claim that abortion opinion and gender are
dependent.
Or
There is not enough evidence to show that there is a difference between gender and position
on abortion.
Example 2:
Use StatCrunch to redo example 1 of testing whether an individual's
opinion regarding abortion is independent of gender at the  ο€½ 0.10
level of significance.
(a) Setup
Same as before
(b) P ο€­ value from Statcrunch
Input the data as shown.
Stat --> Tables --> Contingency --> With Summary --> Under Select Column(s),
click Pro Life and Ctrl click Pro choice --> Under Row Labels, select Gender -->
Under Display, select Expected count --> Compute
StatCrunch Results:
(c) Conclusion
P-value = 0.8489 which is the same as before.
Example 3:
Test whether prenatal care and the wantedness of pregnancy are independent
at the  ο€½ 0.05 level of significance.
Note: df = (r-1)(c-1) = (3-1)(3-1) = 4
(a) Setup
Ho: Prenatal care and β€˜wantedness’ of pregnancy are independent.
H1: Prenatal care and β€˜wantedness’ of pregnancy are dependent.
Or
Ho: Prenatal care and β€˜wantedness’ of pregnancy are not associated.
H1: Prenatal care and β€˜wantedness’ of pregnancy are associated.
(b) P ο€­ value
Input the data into Statcrunch (see below)
Stat --> Tables --> Contingency --> With Summary --> Under Select Column(s),
click Less than 3 months, 3 to 5 Months, and More Than 5 Months (use the
Ctrl) --> Under Row Labels, select Wantedness of Pregnancy --> Under
Display, select Expected count --> Compute
StatCrunch Results:
P-value (0.0003) which is unusual and 0.0003 is less than 0.05. Reject the
null hypothesis.
(c) Conclusion
There is enough evidence to show that prenatal care and β€˜wantedness’ of pregnancy are
dependent (associated).
Ch 12.3 Comparing Three or More Means
- One-Way Analysis of Variance, ANOVA
(Supplemental Materials)
Objective A :One-Way ANOVA Test
Condition: π‘ π‘™π‘Žπ‘Ÿπ‘”π‘’π‘ π‘‘ < 2π‘ π‘ π‘šπ‘Žπ‘™π‘™π‘’π‘ π‘‘ (the largest standard deviation has to be less than twice the smallest)
π‘₯Μ…1(𝑏𝑙𝑒𝑒) = 5
π‘₯Μ…2(π‘Ÿπ‘’π‘‘) = 8
π‘₯Μ…3(π‘”π‘Ÿπ‘’π‘’π‘›) = 11
𝑦̅1(𝑏𝑙𝑒𝑒) = 5
𝑦̅2(π‘Ÿπ‘’π‘‘) = 8
𝑦̅3(π‘”π‘Ÿπ‘’π‘’π‘›) = 11
There is small variability β€˜within’ each sample compared to the variability between the means (notice
there is no overlap of the intervals).
Here there is large variability β€˜within’ each sample compared to the variability between the means. In
this case it is harder to determine if there is a significant difference between the means.
Notice the ratio uses the β€˜between’ variability to β€˜within’ variability.
Example 1:
(a) Setup:
Ho: The mean reaction times are the same for all three groups.
H1: At least one of the group’s mean reaction time is different.
or
Ho: πœ‡1 = πœ‡2 = πœ‡2
H1: πœ‡1 β‰  πœ‡2 or πœ‡2 β‰  πœ‡3 or πœ‡1 β‰  πœ‡3
(b)
1.
2.
3.
4.
There are 3 simple random samples.
The 3 samples are independent of each other.
Normal probability plots indicate that the sample data come from a normal population.
If the largest sample standard deviation is no more than twice the smallest sample
standard deviation, we can assume the populations have the same variance.
We can use Statcrunch to find the standard deviations for each group. Input the data into the first three
columns as shown.:
Stat οƒ  Summary Stats οƒ  Columns οƒ  Input the following οƒ  Compute
Verify: largest SD < 2 smallest SD
0.1100 < 2(0.0638)
0.1100< 0.1276 true
We can assume the populations have the same variance.
(C)
P value from Statcrunch:
Stat οƒ  ANOVA οƒ  One Way οƒ  Select all three columns to compare (Simple, Go/No Go, Choice) οƒ 
Compute
Note: We could have obtained each sample standard deviation using ANOVA instead of using
Summary Stats.
P-value = 0.0681 which is not unusual and 0.0681 is not less than 0.05. Do not reject the null
hypothesis.
Conclusion: There is not sufficient evidence to support the claim that at least one mean reaction
time is different from the others.
(d) Draw boxplots of the three stimuli.
Stat οƒ  Graph οƒ  Boxplots οƒ  Select all three columns οƒ  Check draw boxes horizontally and select
the box to show the means οƒ Compute
d) Compute the 95 % CI for each group.
T stats – one sample – with data (do this for each group):
Simple (0.352 0.486)
Go no go (0.354, 0.586)
Choice (0.455, 0.647)
Diagram of the CI’s:
e) Does the output for the 95% CI support the conclusion from the hypothesis test?
All intervals overlap. Therefore, there is no difference between the three groups.
This is the same conclusion as before.
f) Test the hypothesis at a 0.10 significance level.
In this case, the p value of 0.681 < 0.10 so it is unusual at this significance level. Therefore, reject the
null.
Conclusion: There is enough evidence to support the claim that there is a difference in reaction time in
at least one group. (However, we don’t necessarily which group was the different one.)
g) Find the corresponding 90% CI and show how it supports the conclusion above.
T stats – one sample – with data (do this for each group):
Simple (0.367 0.472)
Go no go (0.380, 0.561
Choice (0.475, 0.626)
Diagram of the CI’s:
Since group 1 and group 3 do not overlap, then there is a difference among the three groups. This is the
same conclusion as above. Furthermore, we know that the two groups that were significantly different
were group 1 & 3.
Ch 12.4 Two - Way Analysis of Variance
(Supplemental Materials)
Objective A : Two - Way ANOVA Test
An example of interaction effect is sleeping pills and alcohol. They are usually not fatal when
taken alone, but can be fatal when combined.
Example 1:
(a) Verify that the largest sample standard deviation is no more than twice the smallest standard
deviation. If this is true, we can assume the populations have the same variance.
Input the data in StatCrunch.
Stat οƒ  Summary Stats οƒ  Columns οƒ  Input the following, then click Compute
The largest SDis 2.6457513 and the smallest SD is 1.5275252.
Verify: largest SD < 2 smallest SD
2.64< 2 (1.53)
2.64< 3.06 true
We can assume the populations have the same variance.
(b) Test whether there is an interaction effect between the drug dosage and age.
Inputting the data is a bit tricky for a two-way ANOVA analysis.
Use cut and paste or type the data in to produce three columns.
οƒ  Response (HDL), Row Factor (Age), Col Factor (Dosage) οƒ  see below.
Stat οƒ  ANOVA οƒ  Two Way οƒ  Input the following οƒ  Compute
Click on β€˜ >’ for the next page of the StatCrunch outputs:
The above graph is called the interaction plots. We look at the level of parallelism among the lines. Since
the lines are roughly parallel, we conclude there is no interaction between age and drug dosages.
(c) If there is no interaction between age and drug dosages, determine whether there
is sufficent evidence to conclude that the mean increase in HDL cholesterol is different
(i) among each drug dosage group, (ii) for each age group.
(i) the mean increase in HDL cholesterol among each drug dosage group is different
The P-value for dosage is <0.0001 which is unusual and 0.0001 is less than 0.05. Reject Ho. There is
sufficient evidence to support the claim that HDL cholesterol level changes with dosage.
Hit > for the next page of the StatCrunch outputs:
The above graph indicates the mean of HDL increases as the drug dosage increases.
(ii) the mean increase in HDL cholesterol among each age group is different
P-value for age is 0.0838 which is not unusual and 0.0838 is not less than 0.05. Do not reject Ho.
There is not sufficient evidence to support the claim that HDL cholesterol changes with age.