Вы находитесь на странице: 1из 12

Review: One-sample Test

1. Assumption: 2. State H0 and H1

Hypothesis Test: Comparing Two Groups

3. Choose a -level
typically .05, sometimes .10 or .01

4. Look up value of test statistic corresponding to

the -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

GOG 502/PLN 504 Youqin Huang

Small Sample

GOG 502/PLN 504 Youqin Huang

GOG 502/PLN 504 Youqin Huang

Todays Topic: Hypothesis 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
GOG 502/PLN 504 Youqin Huang 5

Two-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)
GOG 502/PLN 504 Youqin Huang 6

Two-sample Test: Difference in Means


Question: Is the difference due to the

Example: Test Scores

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

GOG 502/PLN 504 Youqin Huang

GOG 502/PLN 504 Youqin Huang

Example: Hypothesis
Issue:
How likely is it to have sample means with a difference of -5.45, if population means are the same (difference=0)?

Strategy for Mean Difference


bars) cluster around the true mean:

The C.L.T. defines how sample means (Y The center and width of the sampling distribution This tells us the range of values where Y-bars fall

Hypothesis:
OR

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
GOG 502/PLN 504 Youqin Huang

GOG 502/PLN 504 Youqin Huang

10

Strategy for Mean Difference


Visually: If each population has a sampling

The Central Limit Theorem


1. As n grows large, the sampling

distribution, the difference does too:


2. 3.

distribution of the sample mean (Y-bar) approaches normality

GOG 502/PLN 504 Youqin Huang

12

A Corollary of the C.L.T


For any two random samples (of size n1, n2), with 1, 2

Types of Two-sample Test


Samples:
Independent random samples Dependent samples (time-series, husband-wife pair)

and 1, 2 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

Data type:
Quantitative: comparing two means Qualitative: comparing two proportions

Sample size:
sampling distributions 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


GOG 502/PLN 504 Youqin Huang 13 GOG 502/PLN 504 Youqin Huang 14

Two-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 -level
typically .05, sometimes .10 or .01

Two-sample Test: Difference in Means


Two-tailed test:
H0: 1=2 H1: 12 E.g. boys mean test score is different from girls.

One-tailed test:
H0: 1<=2 H1: 1>2 E.g. boys mean test score is higher than girls H0: 1>=2 H1: 1<2 E.g. boys mean test score is lower than girls
15 GOG 502/PLN 504 Youqin Huang 16

6. Compare P-value with -level


If P is smaller, significant, we reject H0 If P is larger, not significant, we fail to reject H0
GOG 502/PLN 504 Youqin Huang

Two-sample Test: Difference in Means


Two independent samples
n1, Y-bar1, s1; n2, Y-bar2,s2; assume large n1, n2 (>20)

Z-Values for Mean Differences


Visually,
Large Z Small Z

Hypotheses:
H0: 1=2 (or 1-2=0); H1: 12 (or 1-20);

Z-test, calculate z-score Q: In which case can we reject H0? When Z is large, it is highly unlikely that the

difference in populations means is zero


GOG 502/PLN 504 Youqin Huang

GOG 502/PLN 504 Youqin Huang

17

18

Example: Elements
Test score differences for boys and girls
n1=30, Y-barboys = 72.75, sboys = 8.80 n2=30, Y-bargirls = 78.20, sgirs = 9.55

Example: Z-value
Calculate Z-value:

Assume sample sizes are large, use z-test Choose =.05, two-tailed test
Critical Z = 1.96 P=2*0.0107 =0.0214< 0.05 (OR |Observed Z| = 2.30, critical Z = 1.96)

Hypotheses:

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.
GOG 502/PLN 504 Youqin Huang 20

GOG 502/PLN 504 Youqin Huang

19

Small Sample Mean Difference


But we often have small samples: medical test,

Example: T-test
Example setup
Boys: n1=15, Y-bar = 72.75, s1 = 8.80; Girls: n2=15, Y-bar = 78.20, s2 = 9.55 Hypothesis: -level: 0.1

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)

Calculate t-score

Where (n1 + n2 2) refers to the degrees of freedom


GOG 502/PLN 504 Youqin Huang 21 GOG 502/PLN 504 Youqin Huang 22

Example: Two-tailed Test


Calculate the standard error of mean difference:

Example: One-tailed Test


One-tailed t test: Girls mean test score is higher than

boys

Critical value for a=0.1, one-tailed t-test, df=28

The critical value for a=0.1, two-tailed t(28)=1.701 |Observed t-value| = 1.63 < Critical Value

One-tailed test: t(28)=1.313

Observed t =-1.63
|observed t| > Critical Value

Can we reject the null hypothesis (H0)? No! We fail to reject H0, and we cannot accept
GOG 502/PLN 504 Youqin Huang

We can reject the null hypothesis! We accept H1 that girls

perform better than boys

H1. We are not sure boys are different from girls.


23

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.
GOG 502/PLN 504 Youqin Huang 24

Independent Two-sample Test


Attitude toward drunk driving Two groups: control vs. experiment Hypotheses: H0: 1=2 H1: 12

Independent Two-sample Test

Define test variable and group variable

Output

Two sample means are different (6 vs. 12.05) Are population means different?

H0: 1=2 H1: 12


GOG 502/PLN 504 Youqin Huang 27 GOG 502/PLN 504 Youqin Huang 28

Two-stage decision-making: 1) Levenes Test for Equal Variances (F-test) H0: 1= 2 H1: 1 2 0.121 > 0.05, fail to reject H0, equality of variance assumed, use the first row If Sig. < 0.05, reject H0, equality of variance not assumed, use the second row

Two-stage decision-making: 1) Levenes Test for Equal Variance (F-test)


Equal variances assumed, use results in the first row

2) T-test: two-sample test on sample means


H0: 1=2 H1: 12 P=0.043 <0.05, significant at 0.05 level, reject H0, accept H1 that the two groups are different. What if H0: 1 >=2, H1: 1<2?

Dependent Two-sample Test


Each observation in sample 1 has a matching

Dependent Two-sample Test

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

So, we can base analyses about 1-2 on inference

samples equals the mean of the difference in scores


If Di=V1i-V2i, then D=1-2
GOG 502/PLN 504 Youqin Huang 31

about D , thus, reduces a two-sample problem to a one-sample problem Previous hypothesis: H0: 1=2; H1: 12 Now: H0: D=0; H1: D 0
GOG 502/PLN 504 Youqin Huang

32

Dependent Two-sample Test

Example
Critical value for two-tailed t-test at 0.05

level, with df=2? Observed t-score 6.9 > 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 When n1>30, z-score can substitute for the t-score
GOG 502/PLN 504 Youqin Huang 33 GOG 502/PLN 504 Youqin Huang 34

Paired Two-sample Test in SPSS


Pre-test vs. Post-test

Hypotheses? Conclusion?
GOG 502/PLN 504 Youqin Huang 36

Review: Two-sample Tests of Means


Hypothesis is based on theory Often conduct a two-tailed test. After accepting

Review: Two-sample Tests of Means


Two-tailed test:
H0: 1=2 H1: 12 E.g. boys mean score is different from girls. |calculated t| > critical value, reject H0

the H1 that two groups are different, develop onetailed H1 and conduct one-tailed test tests; difference is at the stage of finding out the critical value in Z or t-table based on predetermined significance level

One-tailed test:
H0: 1<=2 H1: 1>2 E.g. boys mean test score is higher than girls calculated t >0 and |t| > C.V., reject H0 H0: 1>=2 H1: 1<2 E.g. boys mean test score is lower than girls Calculated t < 0 and |t| > C.V., reject H0
37 GOG 502/PLN 504 Youqin Huang 38

Same calculation for one-tailed and two-tailed

GOG 502/PLN 504 Youqin Huang

Two-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: 1>=2; H1: 1< 2 OR H0: 1<=2 , H1: 1>2 (one-tail) Choose the -level; get the critical value

Sampling distribution of the difference in

Two-sample Test: Difference in Proportions


proportion
Z-score:

Although we can use the sum of standard errors of two sampling distributions, its preferable to use the following pooled estimate

Calculate test statistic (z-score or t-score) Compare test statistic with the critical value Conclusion
GOG 502/PLN 504 Youqin Huang

-hat is the proportion of the total sample (two samples combined)


39 GOG 502/PLN 504 Youqin Huang 40

10

Example
Do you agree or disagree that women

Example
H0: 1=2;

should take care of running their homes and leave running the country up to men? n1=345, 122 agree (0.35), 223 disagree n2=1900, 268 agree (0.14), 1632 disagree -hat1=0.35, -hat2=0.14; -hat=(122+268)/(345+1900)=0.174

H1: 1 2

Choose the -level=0.05; critical value=1.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.

GOG 502/PLN 504 Youqin Huang

41

GOG 502/PLN 504 Youqin Huang

42

Example
H0: 1<=2;

H1: 1 > 2

Choose the -level=0.05; critical value=1.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.
GOG 502/PLN 504 Youqin Huang 43

11

Hypothesis Test: Errors


Due to the probabilistic nature of tests, there

Hypothesis Test: Errors


When we falsely reject H0 Alpha level of the test

will be errors. Sometimes the null hypothesis is true, but we will reject it
Our alpha-level determines the probability of this

Type I error Type II

When we falsely fail to reject H0,

error

Inversely related to alpha level

Sometimes we do not reject the null

hypothesis, even though it is false

GOG 502/PLN 504 Youqin Huang

45

GOG 502/PLN 504 Youqin Huang

46

Summary
Type II Error Type I Error

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

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

GOG 502/PLN 504 Youqin Huang

47

GOG 502/PLN 504 Youqin Huang

48

12

Вам также может понравиться