Upload
hamis-rabiam-magunda
View
218
Download
0
Embed Size (px)
Citation preview
7/27/2019 ANOVA.short .Course
1/49
T-TESTSAND
ANALYSISOF VARIANCEJennifer Kensler
7/27/2019 ANOVA.short .Course
2/49
ONE SAMPLE T-TEST
7/27/2019 ANOVA.short .Course
3/49
7/27/2019 ANOVA.short .Course
4/49
7/27/2019 ANOVA.short .Course
5/49
STEP 2: CHECKTHE ASSUMPTIONS
The sample is random.
The population from which the sample is drawn is
either normal or the sample size is large.
7/27/2019 ANOVA.short .Course
6/49
STEPS 3-5
Step 3: Calculate the test statistic:
Where
Step 4: Calculate the p-value based on theappropriate alternative hypothesis.
Step 5: Write a conclusion.
ns
yt
/
0
1
1
2
n
yy
s
n
i
i
7/27/2019 ANOVA.short .Course
7/49
IRIS EXAMPLE
A researcher would like to know whether the mean
sepal width of a variety of irises is different from 3.5
cm.
The researcher randomly measures the sepal width
of 50 irises.
Step 1: HypothesesH0: = 3.5 cm
Ha: 3.5 cm
7/27/2019 ANOVA.short .Course
8/49
JMP
Steps 2-4:
JMP Demonstration
Analyze Distribution
Y, Columns: Sepal Width
Test Mean
Specify Hypothesized Mean: 3.5
7/27/2019 ANOVA.short .Course
9/49
JMP OUTPUT
Step 5 Conclusion: The sepal width is notsignificantly different from 3.5 cm.
7/27/2019 ANOVA.short .Course
10/49
7/27/2019 ANOVA.short .Course
11/49
TWO SAMPLE T-TEST
Two sample t-tests are used to determine whether
the mean of one group is equal to, larger than or
smaller than the mean of another group.
Example: Is the mean cholesterol of people taking
drug A lower than the mean cholesterol of people
taking drug B?
7/27/2019 ANOVA.short .Course
12/49
STEP 1: FORMULATETHE HYPOTHESES
The population means of the two groups are not
equal.
H0: 1 = 2
Ha
: 1
2
The population mean of group 1 is greater than the
population mean of group 2.
H0: 1 = 2
Ha:
1>
2 The population mean of group 1 is less than the
population mean of group 2.
H0: 1 = 2
Ha: 1 < 2
7/27/2019 ANOVA.short .Course
13/49
STEP 2: CHECKTHE ASSUMPTIONS
The two samples are random and independent.
The populations from which the samples are drawn
are either normal or the sample sizes are large.
The populations have the same standard deviation.
7/27/2019 ANOVA.short .Course
14/49
STEPS 3-5
Step 3: Calculate the test statistic
where
Step 4: Calculate the appropriate p-value.
Step 5: Write a Conclusion.
21
21
11
nn
s
yyt
p
2
)1()1(
21
2
22
2
11
nn
snsnsp
7/27/2019 ANOVA.short .Course
15/49
TWO SAMPLE EXAMPLE
A researcher would like to know whether the mean
sepal width of a setosa irises is different from the
mean sepal width of versicolor irises.
Step 1 Hypotheses:
H0: setosa = versicolor
Ha: setosa versicolor
7/27/2019 ANOVA.short .Course
16/49
JMP
Steps 2-4:
JMP Demonstration:
Analyze Fit Y By X
Y, Response: Sepal WidthX, Factor: Species
7/27/2019 ANOVA.short .Course
17/49
7/27/2019 ANOVA.short .Course
18/49
PAIRED T-TEST
7/27/2019 ANOVA.short .Course
19/49
PAIRED T-TEST
The paired t-test is used to compare the means of
two dependent samples.
Example:A researcher would like to determine if background
noise causes people to take longer to complete
math problems. The researcher gives 20 subjects
two math tests one with complete silence and one
with background noise and records the time each
subject takes to complete each test.
7/27/2019 ANOVA.short .Course
20/49
STEP 1: FORMULATETHE HYPOTHESES
The population mean difference is not equal to zero.
H0: difference = 0
Ha: difference 0
The population mean difference is greater than zero.H0: difference = 0
Ha: difference > 0
The population mean difference is less than a zero.
H0: difference = 0
Ha: difference < 0
7/27/2019 ANOVA.short .Course
21/49
STEP 2: CHECKTHEASSUMPTIONS
The sample is random.
The data is matched pairs.
The differences have a normal distribution or the
sample size is large.
7/27/2019 ANOVA.short .Course
22/49
STEPS 3-5
ns
dt
d /
0
Where d bar is the mean of the differences and sd is
the standard deviations of the differences.
Step 4: Calculate the p-value.
Step 5: Write a conclusion.
Step 3: Calculate the test Statistic:
7/27/2019 ANOVA.short .Course
23/49
PAIRED T-TEST EXAMPLE
A researcher would like to determine whether a
fitness program increases flexibility. The researcher
measures the flexibility (in inches) of 12 randomly
selected participants before and after the fitness
program.
Step 1: Formulate a Hypothesis
H0: After-Before = 0
Ha: After-Before > 0
7/27/2019 ANOVA.short .Course
24/49
PAIRED T-TEST EXAMPLE
Steps 2-4:
JMP Analysis:
Create a new column of After Before
Analyze DistributionY, Columns: After Before
Test Mean
Specify Hypothesized Mean: 0
7/27/2019 ANOVA.short .Course
25/49
JMP OUTPUT
Step 5 Conclusion: There is not evidence that thefitness program increases flexibility.
7/27/2019 ANOVA.short .Course
26/49
ONE-WAY ANALYSISOF VARIANCE
7/27/2019 ANOVA.short .Course
27/49
ONE-WAY ANOVA
ANOVA is used to determine whether three or more
populations have different distributions.
A B C
Medical Treatment
7/27/2019 ANOVA.short .Course
28/49
ANOVA STRATEGY
The first step is to use the ANOVAF test to
determine if there are any significant differences
among means.
If the ANOVA F test shows that the means are not
all the same, then follow up tests can be performed to
see which pairs of means differ.
7/27/2019 ANOVA.short .Course
29/49
7/27/2019 ANOVA.short .Course
30/49
ONE-WAY ANOVA HYPOTHESIS
Step 1: We test whether there is a difference in the
means.
equal.allnotareThe:
: 210
ia
r
H
H
7/27/2019 ANOVA.short .Course
31/49
STEP 2: CHECK ANOVA ASSUMPTIONS
The samples are random and independent of each
other.
The populations are normally distributed.
The populations all have the same variance.
The ANOVA F test is robust to the assumptions of
normality and equal variances.
7/27/2019 ANOVA.short .Course
32/49
STEP 3: ANOVA F TEST
Compare the variation within the samples to the
variation between the samples.
A B C A B C
Medical Treatment
7/27/2019 ANOVA.short .Course
33/49
ANOVA TEST STATISTIC
MSE
MSG
GroupswithinVariation
GroupsbetweenVariationF
Variation within groups small
compared with variation
between groups
Large F
Variation within groups large
compared with variation
between groups Small F
7/27/2019 ANOVA.short .Course
34/49
MSG
1-r
)(n)(n)(n
1-r
SSGMSG
2
1r
2
22
2
11
yyyyyy
The mean square for groups, MSG, measures the
variability of the sample averages.
SSG stands for sums of squares groups.
7/27/2019 ANOVA.short .Course
35/49
MSE
1
)(
s
Where
r-n
1)s-(n1)s-(n1)s-(n
r-n
SSEMSE
1
i
2
rr
2
22
2
11
i
n
j
iij
n
yyi
Mean square error, MSE, measures the variabilitywithin the groups.
SSE stands for sums of squares error.
7/27/2019 ANOVA.short .Course
36/49
STEPS 4-5
Step 4: Calculate the p-value.
Step 5: Write a conclusion.
7/27/2019 ANOVA.short .Course
37/49
ANOVA EXAMPLE
A researcher would like to determine if three drugs
provide the same relief from pain.
60 patients are randomly assigned to a treatment
(20 people in each treatment).
Step 1: Formulate the Hypotheses
H0: DrugA = Drug B = Drug C
Ha : The i are not all equal.
7/27/2019 ANOVA.short .Course
38/49
STEPS 2-4
JMP demonstration
Analyze Fit Y By X
Y, Response: Pain
X, Factor: Drug
7/27/2019 ANOVA.short .Course
39/49
7/27/2019 ANOVA.short .Course
40/49
FOLLOW-UP TEST
The p-value of the overall F test indicates that level
of pain is not the same for patients taking drugs A,
B and C.
We would like to know which pairs of treatments
are different.
One method is to use Tukeys HSD (honestly
significant differences).
7/27/2019 ANOVA.short .Course
41/49
TUKEY TESTS
Tukeys test simultaneously tests
JMP demonstration
Oneway Analysis of Pain By Drug
Compare Means All Pairs, Tukey HSD
'a
'0
:H
:H
ii
ii
for all pairs of factor levels. Tukeys HSD controls
the overall type I error.
7/27/2019 ANOVA.short .Course
42/49
7/27/2019 ANOVA.short .Course
43/49
ANALYSISOF COVARIANCE
7/27/2019 ANOVA.short .Course
44/49
ANALYSIS OF COVARIANCE (ANCOVA)
Covariates are variables that may affect the
response but cannot be controlled.
Covariates are not of primary interest to the
researcher.
We will look at an example with two covariates, the
model is
ijiijy covariates
7/27/2019 ANOVA.short .Course
45/49
ANCOVA EXAMPLE
Consider the previous example where we tested
whether the patients receiving different drugs
reported different levels of pain. Perhaps age and
gender may influence the efficacy of the drug. We
can use age and gender as covariates.
JMP demonstration
Analyze Fit Model
Y: Pain
Add: Drug
Age
Gender
7/27/2019 ANOVA.short .Course
46/49
JMP OUTPUT
7/27/2019 ANOVA.short .Course
47/49
CONCLUSION
The one sample t-test allows us to test whether the
mean of a group is equal to a specified value.
The two sample t-test and paired t-test allows us to
determine if the means of two groups are different.
ANOVA and ANCOVA methods allow us to
determine whether the means of several groups are
statistically different.
7/27/2019 ANOVA.short .Course
48/49
SASAND SPSS
For information about using SAS and SPSS to do
ANOVA:
http://www.ats.ucla.edu/stat/sas/topics/anova.htm
http://www.ats.ucla.edu/stat/spss/topics/anova.htm
http://www.ats.ucla.edu/stat/sas/topics/anova.htmhttp://www.ats.ucla.edu/stat/spss/topics/anova.htmhttp://www.ats.ucla.edu/stat/spss/topics/anova.htmhttp://www.ats.ucla.edu/stat/sas/topics/anova.htm7/27/2019 ANOVA.short .Course
49/49
REFERENCES
Fishers Irises Data (used in one sample and two
sample t-test examples).
Flexibility data (paired t-test example):
Michael Sullivan III. Statistics Informed Decisions
Using Data. Upper Saddle River, New Jersey:
Pearson Education, 2004: 602.