Title: Hypothesis Test: Comparing Two Groups
1Hypothesis TestComparing Two Groups
2Review One-sample Test
- 1. Assumption
- 2. State H0 and H1
- 3. Choose a a-level
- typically .05, sometimes .10 or .01
- 4. Look up value of test statistic corresponding
to the a-level (called the critical value) - 5. Calculate the relevant test statistic
- 6. Compare test statistic to critical value
- If test statistic is larger, we reject H0, and
accept H1 - If it is smaller, we fail to reject H0, and
cannot accept H1
3(No Transcript)
4Small Sample
5Todays TopicHypothesis Test (two-sample)
- Elements of two-sample test
- Transforming two-sample into one-sample
- Extension of C.L.T.
- Comparing means of two groups
- Comparing means of two paired groups
- Comparing proportions of two groups
- Hypothesis test errors
- How to conduct hypothesis test in SPSS
6Two-sample Test
- Hypothesis tests on the difference between two
different groups - Examples
- Gender difference in wage/academic performance
- Racial difference in homeownership/ wage/
education - Is drug A better than drug B in reducing the
likelihood of heart disease? - Students who did well in high school perform well
in college (time series)
7Two-sample Test Difference in Means
- Question Is the difference due to the particular
sample? Can we infer that the population means
are different? - Example test scores for 20 boys, 20 girls
- Y-barboys 72.75, s 8.80
- Y-bargirls 78.20, s 9.5
8Example Test Scores
9Example Hypothesis
- Issue
- How likely is it to have sample means with a
difference of -5.45, if population means are the
same (difference0)? - Hypothesis
OR
10Strategy for Mean Difference
- The C.L.T. defines how sample means (Y-bars)
cluster around the true mean - The center and width of the sampling distribution
- This tells us the range of values where Y-bars
fall - For any two means, the difference will also fall
in a certain range - Group 1 means range from 6.0 to 8.0
- Group 2 means range from 1.0 to 2.0
- Difference in means will range from 4.0 to 7.0
11Strategy for Mean Difference
- Visually If each population has a sampling
distribution, the difference does too
12The Central Limit Theorem
- As n grows large, the sampling distribution of
the sample mean (Y-bar) approaches normality -
-
13A Corollary of the C.L.T
- For any two random samples (of size n1, n2), with
m1, m2 and s1, s2 for two sampling distributions,
the sampling distribution for the difference of
two means is normal, with a mean and S.D. - The mean is the difference of the means of two
sampling distributions - The variance is equal to the sum of variances of
two sampling distributions
14Types of Two-sample Test
- Samples
- Independent random samples
- Dependent samples (time-series, husband-wife
pair) - Data type
- Quantitative comparing two means
- Qualitative comparing two proportions
- Sample size
- Large sample, use z test, calculate z-score
- Small sample, use t test, calculate t-score
- Hypothesis one-tail vs. two-tail test
- Different combinations
15Two-sample Test Steps
- 1. Assumption
- 2. State H0 and H1
- 3. Calculate the relevant test statistic
- 4. Find out corresponding P-value
- 5. Choose a a-level
- typically .05, sometimes .10 or .01
- 6. Compare P-value with a-level
- If P is smaller, significant, we reject H0
- If P is larger, not significant, we fail to
reject H0
16Two-sample Test Difference in Means
- Two-tailed test
- H0 m1m2
- H1 m1?m2
- E.g. boys mean test score is different from
girls. - One-tailed test
- H0 m1ltm2
- H1 m1gtm2
- E.g. boys mean test score is higher than girls
- H0 m1gtm2
- H1 m1ltm2
- E.g. boys mean test score is lower than girls
17Two-sample Test Difference in Means
- Two independent samples
- n1, Y-bar1, s1 n2, Y-bar2,s2 assume large n1,
n2 (gt20) - Hypotheses
- H0 ?1?2 (or ?1-?20)
- H1 ?1??2 (or ?1-?2?0)
- Z-test, calculate z-score
18Z-Values for Mean Differences
- Visually,
- Q In which case can we reject H0?
- When Z is large, it is highly unlikely that the
difference in populations means is zero
19Example Elements
- Test score differences for boys and girls
- n130, Y-barboys 72.75, sboys 8.80
- n230, Y-bargirls 78.20, sgirs 9.55
- Assume sample sizes are large, use z-test
- Choose a.05, two-tailed test
- Critical Z 1.96
- Hypotheses
20Example Z-value
- Calculate Z-value
- P20.0107 0.0214lt 0.05
- (OR Observed Z 2.30, critical Z 1.96)
- Q can we reject H0?
- YES! We are 95 confident that H0 can be
rejected, and we can accept that the two groups
are different.
21Small Sample Mean Difference
- But we often have small samples medical test,
spatial units - Use T-test
- The computation of df value is very complex
- Assume the same variability for the two groups
(homoscedasticity) ? a simpler df expression - The standard error can be derived from the
variances of both groups (i.e. pooled)
22Example T-test
- Example setup
- Boys n115, Y-bar 72.75, s1 8.80
- Girls n215, Y-bar 78.20, s2 9.55
- Hypothesis
- a-level 0.1
- Calculate t-score
23Example Two-tailed Test
- Calculate the standard error of mean difference
- The critical value for a0.1, two-tailed
t(28)1.701 - Observed t-value 1.63 lt Critical Value
- Can we reject the null hypothesis (H0)?
- No! We fail to reject H0, and we cannot accept
H1. We are not sure boys are different from
girls.
24Example One-tailed Test
- One-tailed t test Girls mean test score is
higher than boys - Critical value for a0.1, one-tailed t-test,
df28 - One-tailed test t(28)1.313
- Observed t -1.63
- observed t gt Critical Value
- We can reject the null hypothesis! We accept H1
that girls perform better than boys - Moral of the story
- If you have strong directional suspicions ahead
of time, use a one-tailed test. It increases
your chance of rejecting H0.
25Dependent Two-sample Test
- Each observation in sample 1 has a matching
observation in sample 2 matched-pairs - Same sample, repeated measurement (time series)
- Two samples, but paired observations
(husband-wife father-son) - Same sample sizes n1 n2
- Difference between the means of the two samples
equals the mean of the difference in scores - If DiV1i-V2i, then ?D?1-?2
26Dependent Two-sample Test
- So, we can base analyses about ?1-?2 on inference
about ?D , thus, reduces a two-sample problem to
a one-sample problem - Previous hypothesis H0 ?1?2 H1 ?1??2
- Now H0 ?D0 H1 ?D
?0
27Dependent Two-sample Test
- Calculate test statistic (t-score, z-score)
When n1gt30, z-score can substitute for the t-score
28Example
- Critical value for two-tailed t-test at 0.05
level, with df2? - Observed t-score 6.9 gt critical value 4.303
- Reject H0 two therapies are different.
- Benefits of using dependent samples
- Many sources of potential bias are controlled
- Same sample same gender, personality
- Couples same lifestyle
29Review Two-sample Tests of Means
- Hypothesis is based on theory
- Often conduct a two-tailed test. After accepting
the H1 that two groups are different, develop
one-tailed H1 and conduct one-tailed test - Same calculation for one-tailed and two-tailed
tests difference is at the stage of finding out
the critical value in Z or t-table based on
predetermined significance level
30Review Two-sample Tests of Means
- Two-tailed test
- H0 m1m2 H1 m1?m2
- E.g. boys mean score is different from girls.
- calculated t gt critical value, reject H0
- One-tailed test
- H0 m1ltm2 H1 m1gtm2
- E.g. boys mean test score is higher than girls
- calculated t gt0 and t gt C.V., reject H0
- H0 m1gtm2 H1 m1ltm2
- E.g. boys mean test score is lower than girls
- Calculated t lt 0 and t gt C.V., reject H0
31Two-sample Test Difference in Proportions
- Qualitative data
- Two samples n1, ?-hat1 n2, ?-hat2
- Similar steps as two-sample test for means
- Hypotheses
- H0 ?1?2 H1 ?1? ?2 (two-tail)
- H0 ?1gt?2 H1 ?1lt ?2 OR
- H0 ?1lt?2 , H1 ?1gt?2 (one-tail)
- Choose the a-level get the critical value
- Calculate test statistic (z-score or t-score)
- Compare test statistic with the critical value
- Conclusion
32Two-sample Test Difference in Proportions
- Sampling distribution of the difference in
proportion - Z-score
- Although we can use the sum of standard errors of
two sampling distributions, its preferable to
use the following pooled estimate -
- p-hat is the proportion of the total sample (two
samples combined)
33Example
- Do you agree or disagree that women should take
care of running their homes and leave running the
country up to men? - n1345, 122 agree (0.35), 223 disagree n21900,
268 agree (.14), 1632 disagree - ?-hat10.35, ?-hat20.14
- ?-hat(122268)/(3451900)0.174
34Example
- H0 ?1?2 H1 ?1? ?2
- Choose the a-level0.05 critical value1.96
- Calculate the z-score z-9.6
- Significant at 0.05 level reject H0, and accept
H1, which means two samples are from two
different populations.
35Example
- H0 ?1lt?2 H1 ?1 gt ?2
- Choose the a-level0.05 critical value1.65
- Calculate the z-score z-9.6 (same calculation
as two-tailed test) - Significant at 0.05 level reject H0, and accept
H1, which means the second population is less
likely to agree with the statement.
36(No Transcript)
37Hypothesis Test Errors
- Due to the probabilistic nature of tests, there
will be errors. - Sometimes the null hypothesis is true, but we
will reject it - Our alpha-level determines the probability of
this - Sometimes we do not reject the null hypothesis,
even though it is false
38Hypothesis Test Errors
- When we falsely reject H0 ?Type I error
- Alpha level of the test
- When we falsely fail to reject H0, ?Type II error
- Inversely related to alpha level
39- Cannot minimize both types of error.
- In general, we are most concerned about Type I
error try to be conservative (smaller alpha). - Use a large sample to reduce both types of error
40Summary
- Elements of two-sample test
- Corollary of C.L.T
- General steps
- Independent two-sample test of means
- Dependent two-sample test of means
- Two-sample test of proportions
- The issue of errors
- How to do these tests in SPSS
41One-sample Test of Mean in SPSS
42Independent Two-sample Test
43- Levenes Test for Equality of Variance (F-test)
- H0 ?1 ?2
- H1 ?1? ?2
- 0.795 gt 0.05, fail to reject H0, equality of
variance assumed, use the first row - If Sig. lt 0.05, reject H0, equality of variance
not assumed, use the second row
44Paired Two-sample Test in SPSS
45(No Transcript)