Statistical Methods Statistical Methods Descriptive Inferential - - PowerPoint PPT Presentation

statistical methods
SMART_READER_LITE
LIVE PREVIEW

Statistical Methods Statistical Methods Descriptive Inferential - - PowerPoint PPT Presentation

Statistical Methods Statistical Methods Descriptive Inferential Statistics Statistics Hypothesis Others Estimation Testing Outline of today Hypothesis testing for one population mean Hypothesis testing for two samples comparing


slide-1
SLIDE 1
slide-2
SLIDE 2

Statistical Methods

Statistical Methods Descriptive Statistics Inferential Statistics Estimation Hypothesis Testing Others

slide-3
SLIDE 3

Outline of today

  • Hypothesis testing for one population mean
  • Hypothesis testing for two samples comparing the differences

between:

  • The means of two related populations:
  • Paired t-test
  • The means of two independent populations
  • Two-sample t-test
  • The variances of two populations
  • F test
slide-4
SLIDE 4

Motivating Eg: Birth Weight

  • Average birth weight in the general population is 120 oz.

You take a sample of 100 babies born in the hospital you work at (that is located in a low-SES area), and find that the sample mean birth weight =115 oz with a sample standard deviation s=24 oz.

  • You wonder:
  • is the mean birth weight of low-SES babies indeed lower than

that in the general population?

  • Or is this observed difference merely due to chance?
  • We need an objective method to determine which hypothesis is right

x

slide-5
SLIDE 5

Null Hypothesis

  • Parameter interest: the mean birth weight of low-SES

babies, denoted by µ

  • We propose a value for µ, denoted as µ0.
  • The null hypothesis,

H0: µ = µ0 E.g. H0: µ = 120

  • Begin with the assumption that the null hypothesis is

true

  • E.g. H0 : the mean birth weight of low-SES babies

is equal to that in the general population

  • Similar to the notion of innocent until proven guilty
  • Purpose: to determine if the data leads us to reject the

null hypothesis

slide-6
SLIDE 6

Alternative Hypothesis

1. Is set up to represent research goal 2. Opposite of null hypothesis

E.g. Ha : the mean birth weight of SES babies is lower than that in the general population

3. Ha: µ < 120 4. Always has inequality sign: ≠, <, or >

  • ≠ will lead to two-sided tests
  • < , > will lead to one-sided tests
slide-7
SLIDE 7

EX Cardiovascular Disease

  • Suppose we want to compare fasting serum-cholesterol levels

among recent Asian immigrants to the United States with typical levels found in the general U.S. population. Assume cholesterol levels in women aged 21-40 in the United States are approximately normally distributed with mean 190 mg/dL. It is unknown whether cholesterol levels among recent Asian Immigrants are higher or lower than those in the General U.S. Population.

  • Parameter of interest: µ= cholesterol levels among

recent Asian immigrants

  • H0: µ = 190 vs Ha: µ ≠ 190
slide-8
SLIDE 8

Hypothesis testing

  • Formally, a statistical hypothesis testing

problem includes two hypotheses

  • Null hypothesis (H0)
  • Alternative hypothesis (Ha, H1)
  • Hypothesis must be stated before analysis
  • A Belief about a population parameter
  • Parameter is population mean, proportion,

variance NOT samples. We will never have a hypothesis statement with either or in it.

x ˆ p

slide-9
SLIDE 9

Possible Outcomes in Hypothesis Testing

Truth: Real Situation (in practice unknown) Null Hypothesis true Research Hypothesis true Study inconclusive (H0 is accepted) H0 is true and H0 is accepted (Correct decision) H1 is true and H0 is accepted (Type II error=β) Research Hypothesis supported (H0 is rejected) H0 is true and H0 is rejected (Type I Error=α) H1 is true and H0 is rejected (Correct decision) 1-Type II error=1- β=power

slide-10
SLIDE 10

Errors in Making Decision

1. Type I Error

  • Reject null hypothesis H0 when H0 is true
  • type I error is α =Pr(reject H0 | H0 is true)
  • Called level of significance
  • Has serious consequences

2. Type II Error

  • Do not reject H0 when H0 is false (H1 is true)
  • β =Pr(do not reject H0 | H1 is true)

3. Power of a statistical test is 1-β=Pr(reject H0 |H1 is true)

slide-11
SLIDE 11

Ex Birth Weight

  • Average birth weight in the general population is 120 oz. You take a

sample of 100 babies born in the hospital you work at (that is located in a low-SES area), and find that the sample mean birth weight =115 oz with a sample standard deviation s=24 oz.

  • H0: µ = 120 Ha :µ < 120
  • What’s the meaning of type I error?
  • Type II error?

x

slide-12
SLIDE 12

Ex Birth Weight

  • Average birth weight in the general population is 120 oz. You take a

sample of 100 babies born in the hospital you work at (that is located in a low-SES area), and find that the sample mean birth weight =115 oz with a sample standard deviation s=24 oz.

  • H0: µ = 120 Ha :µ < 120
  • What’s the meaning of type I error?

The probability of deciding the mean birth weight in the hospital was lower than 120 oz when in fact it was 120 oz.

  • Type II error?

x

slide-13
SLIDE 13

Ex Birth Weight

  • Average birth weight in the general population is 120 oz. You take a

sample of 100 babies born in the hospital you work at (that is located in a low-SES area), and find that the sample mean birth weight =115 oz with a sample standard deviation s=24 oz.

  • H0: µ = 120 Ha :µ < 120
  • What’s the meaning of type I error?

The probability of deciding the mean birth weight in the hospital was lower than 120 oz when in fact it was 120 oz.

  • Type II error?

The probability of deciding the mean birth weight in the hospital was 120 oz when in fact it was lower than 120 oz.

x

slide-14
SLIDE 14

EX Cardiovascular Disease

  • Assume cholesterol levels in women aged 21-40 in the United

States are approximately normally distributed with mean 190 mg/dL. It is unknown whether cholesterol levels among recent Asian Immigrants are higher or lower than those in the General U.S. Population.

  • Parameter of interest: µ= cholesterol levels among recent Asian

immigrants

  • H0: µ = 190 vs Ha: µ ≠ 190
  • What’s the meaning of type I error?
  • Type II error?
slide-15
SLIDE 15

EX Cardiovascular Disease

  • Assume cholesterol levels in women aged 21-40 in the United

States are approximately normally distributed with mean 190 mg/dL. It is unknown whether cholesterol levels among recent Asian Immigrants are higher or lower than those in the General U.S. Population.

  • Parameter of interest: µ= cholesterol levels among recent Asian

immigrants

  • H0: µ = 190 vs Ha: µ ≠ 190
  • What’s the meaning of type I error?

The probability of deciding that the cholesterol levels among recent Asian immigrants are different from those in the general US population, while the truth is there is no difference.

  • Type II error?
slide-16
SLIDE 16

EX Cardiovascular Disease

  • Assume cholesterol levels in women aged 21-40 in the United

States are approximately normally distributed with mean 190 mg/dL. It is unknown whether cholesterol levels among recent Asian Immigrants are higher or lower than those in the General U.S. Population.

  • Parameter of interest: µ= cholesterol levels among recent Asian

immigrants

  • H0: µ = 190 vs Ha: µ ≠ 190
  • What’s the meaning of type I error?

The probability of deciding that the cholesterol levels among recent Asian immigrants are different from those in the general US population, while the truth is there is no difference.

  • Type II error?

The probability of deciding that the cholesterol levels among recent Asian immigrants are the same as those in the general US population, while the truth is they are different.

slide-17
SLIDE 17

Type I & II Error Relationship

  • Type I and Type II errors cannot happen at

the same time

  • Type I error can only occur if H0 is true

small α means reject H0 less often

  • Type II error can only occur if H0 is false

small β means reject H1 less often

If Type I error probability (α) , then Type II error probability (β)

slide-18
SLIDE 18

α & β Have an Inverse Relationship

α β

Can’t reduce both errors simultaneously: trade-off! General Strategy: fix α at specific level(0.05) and to use the test that minimizes β or, maximizes the power

slide-19
SLIDE 19

Hypothesis Testing

Population

I believe the population mean age is =50 (hypothesis).

Mean x = 20 Reject hypothesis! Not close. Random sample

      

Compare to the hypothesized value 0 µ

x

µ

slide-20
SLIDE 20

t-Test Statistics (σ Unknown)

  • The test statistic is a measure of how close the

data is to the null hypothesis.

  • The larger the test statistic, the further our data is from

the null hypothesis and the stronger the evidence is in favor of the alternative hypothesis.

  • Fact: If H0 is true, then test statistic t follows a t-

distribution on n-1 degrees of freedom, provided the data are from a normal distribution.

/ X t S n −µ =

slide-21
SLIDE 21

Basic Idea:

t statistics

Distribution of t statistics

H0 tn-1 distribution t

n s x t / µ − =

slide-22
SLIDE 22

Rejection Region

1. Def: the range of values of the test statistics t for which H0 is rejected 2. We need a critical (cut-off) value to decide if our sample mean is “too extreme” when null hypothesis is true. 3. Designated α (alpha) for

  • Typical values are .01, .05, .10
  • selected by researcher at start
  • α= P(Rejecting H0 | H0 is true)
slide-23
SLIDE 23

Rejection Region (One-Sided Test)

tn-1, α

α

Rejection Region Nonrejection Region

1 - α Level of Confidence tn-1 Ha: µ < µ0 recall Pr(t<tn-1, α )= α

n s x t / µ − =

slide-24
SLIDE 24

Rejection Region (One-Sided Test)

tn-1, α

α

t Statistic Rejection Region Nonrejection Region

1 - α Level of Confidence tn-1 Observed t statistic Ha: µ < µ0

slide-25
SLIDE 25

Rejection Region (One-Sided Test)

tn-1, α

α

t Statistic Rejection Region Nonrejection Region

1 - α Level of Confidence Observed t statistic Ha: µ < µ0

slide-26
SLIDE 26

Rejection Regions (Two-Sided Test)

1/2 α

Rejection Region

1/2 α

t Statistic Rejection Region Nonrejection Region

1 - α Level of Confidence tn-1, α/2 tn-1, 1-α /2 Ha: µ ≠ µ0

slide-27
SLIDE 27

Rejection Regions (Two-Sided Test)

1/2 α

Rejection Region

1/2 α

t Statistic Rejection Region Nonrejection Region

1 - α Level of Confidence tn-1, α/2 tn-1, 1-α /2 Observed t statistic Ha: µ ≠ µ0

slide-28
SLIDE 28

Rejection Regions (Two-Sided Test)

1/2 α

Rejection Region

1/2 α

t Statistic Rejection Region Nonrejection Region

1 - α Level of Confidence tn-1, α/2 tn-1, 1-α /2 Observed t statistic Ha: µ ≠ µ0

slide-29
SLIDE 29

Rejection Regions (Two-Sided Test)

1/2 α

Rejection Region

1/2 α

t Statistic Rejection Region Nonrejection Region

1 - α Level of Confidence tn-1, α/2 tn-1, 1-α /2 Observed t statistic Ha: µ ≠ µ0

slide-30
SLIDE 30

Birth Weight Example

  • The mean birth weight in the United States is
  • 120oz. You get a list of birth weights from 100

consecutive, full-term, live-born deliveries from the maternity ward of a hospital in a low- SES area.

  • The sample mean birth weight is 115 oz and

standard deviation is 24 oz.

  • Can we actually say the underlying mean birth

weight from this hospital is lower than the national average?

slide-31
SLIDE 31

One-Sided t Test Solution

  • H0:
  • Ha:
  • α =
  • df =
  • Critical Value(s):

Test Statistic: Decision: Conclusion:

slide-32
SLIDE 32

One-Sided t Test Solution

  • H0: µ = 120
  • Ha: µ < 120
  • α =0.05
  • df =
  • Critical Value(s):

Test Statistic: Decision:

08 . 2 100 / 24 120 115 / − = − = − = n s x t µ

slide-33
SLIDE 33

One-Sided t Test Solution

  • H0: µ = 120
  • Ha: µ < 120
  • α =0.05
  • df =100-1=99
  • Critical Value(s): -1.66

EXCEL: t99, .05=-TINV(0.1,99)

Test Statistic: Decision:

08 . 2 100 / 24 120 115 / − = − = − = n s x t µ

slide-34
SLIDE 34

One-Sided t Test Solution

  • H0: µ = 120
  • Ha: µ < 120
  • α =0.05
  • df =100-1=99
  • Critical Value(s): -1.66

EXCEL: t99, .05=-TINV(0.1,99)

Test Statistic: Decision:

08 . 2 100 / 24 120 115 / − = − = − = n s X t µ 66 . 1 08 . 2 − < −

Reject H0 at significant level 0.05 and the true mean birth weight is significantly lower in this hospital than in the general population.

slide-35
SLIDE 35

EX Cardiovascular Disease ( two- sided t-test)

  • Test the hypothesis that the mean cholesterol level of recent female

Asian immigrants is different from the mean in the general U.S. population 190 mg/dL. Blood tests are performed on 100 female Asian immigrants, the mean level mg/dL with standard deviation s=40 mg/dL

52 . 181 = x

slide-36
SLIDE 36

EX Cardiovascular Disease ( two- sided t-test)

  • Test the hypothesis that the mean cholesterol level of recent female

Asian immigrants is different from the mean in the general U.S. population 190 mg/dL. Blood tests are performed on 100 female Asian immigrants, the mean level mg/dL with standard deviation s=40 mg/dL

  • H0: µ = 190 vs Ha: µ ≠ 190

52 . 181 = x

slide-37
SLIDE 37

EX Cardiovascular Disease ( two- sided t-test)

  • Test the hypothesis that the mean cholesterol level of recent female

Asian immigrants is different from the mean in the general U.S. population 190 mg/dL. Blood tests are performed on 100 female Asian immigrants, the mean level mg/dL with standard deviation s=40 mg/dL

  • H0: µ = 190 vs Ha: µ ≠ 190

52 . 181 = x 12 . 2 100 / 40 190 52 . 181 / − = − = − = n s x t µ

slide-38
SLIDE 38

EX Cardiovascular Disease ( two- sided t-test)

  • Test the hypothesis that the mean cholesterol level of recent female

Asian immigrants is different from the mean in the general U.S. population 190 mg/dL. Blood tests are performed on 100 female Asian immigrants, the mean level mg/dL with standard deviation s=40 mg/dL

  • H0: µ = 190 vs Ha: µ ≠ 190

12 . 2 100 / 40 190 52 . 181 / − = − = − = n s x t µ 52 . 181 = x

α =0.05, the critical values are t99, .025 =-TINV(0.05,99) = -1.98, so t99,

.975=1.98.

slide-39
SLIDE 39

EX Cardiovascular Disease ( two- sided t-test)

  • Test the hypothesis that the mean cholesterol level of recent female

Asian immigrants is different from the mean in the general U.S. population 190 mg/dL. Blood tests are performed on 100 female Asian immigrants, the mean level mg/dL with standard deviation s=40 mg/dL

  • H0: µ = 190 vs Ha: µ ≠ 190

12 . 2 100 / 40 190 52 . 181 / − = − = − = n s x t µ 52 . 181 = x

t99, .025 t99, .975

α =0.05, the critical values are t99, .025 =-TINV(0.05,99) = -1.98, so t99,

.975=1.98. Thus t=-2.12 is in the rejection

region.

slide-40
SLIDE 40

EX Cardiovascular Disease ( two- sided t-test)

  • Test the hypothesis that the mean cholesterol level of recent female

Asian immigrants is different from the mean in the general U.S. population 190 mg/dL. Blood tests are performed on 100 female Asian immigrants, the mean level mg/dL with standard deviation s=40 mg/dL

  • H0: µ = 190 vs Ha: µ ≠ 190

12 . 2 100 / 40 190 52 . 181 / − = − = − = n s x t µ 52 . 181 = x

t99, .025 t99, .975

α =0.05, the critical values are t99, .025 =-TINV(0.05,99) = -1.98, so t99,

.975=1.98. Thus t=-2.12 is in the rejection

  • region. H0 is rejected at 5% level of

significance.

Conclusion: the mean cholesterol level of recent Asian immigrants is significantly different from the mean for the general U.S. population

slide-41
SLIDE 41

Determination of Statistical Significance

  • Critical-value method

Calculate the critical value from α and t distribution

  • p-value method

Once we calculate the actual t statistics, we can ask what is the smallest significance level at which we could still reject H0 (observed level of significance)

slide-42
SLIDE 42

p-value

  • Def.: Probability of obtaining a test statistic as extreme
  • r more extreme than actual sample value given H0 is

true

  • For H1: µ < µ0 p-value=P(tn-1<=tobs)

For H1: µ > µ0 p-value=P(tn-1>= tobs) For H1: µ = µ0 p-value= 2P(tn-1<= tobs), if tobs <=0 2(1-P(tn-1<= tobs)), if tobs >0

  • Used to make rejection decision
  • If p-value ≥ α, do not reject H0
  • If p-value < α, reject H0
slide-43
SLIDE 43

Birth Weight Example

  • The mean birth weight in the United States is 120oz.

You get a list of birth weights from 100 consecutive, full-term, live-born deliveries from the maternity ward

  • f a hospital in a low-SES area.
  • The sample mean birth weight is = 115 oz and

standard deviation is s=24 oz.

  • Find the p-value.

x

slide-44
SLIDE 44

One-sided test:

  • 1. t value of sample statistic (observed)

Z

  • 2.08

08 . 2 100 / 24 120 115 / − = − = − = n s x t µ

slide-45
SLIDE 45

One-sided test:

Use alternative hypothesis to find direction p-value is P(t99 <=-2.08) = .020 EXCEL function: TDIST(2.08,99,1)=0.02 Z

  • 2.08

p-Value=.02 tn-1 distribution

Pvalue< α, so H0 is rejected and we conclude that the true mean birth weight is significantly lower in this hospital than in the general population.

slide-46
SLIDE 46

EX Cardiovascular Disease ( two- sided t-test)

  • Test the hypothesis that the mean cholesterol level of

recent female Asian immigrants is different from the mean in the general U.S. population 190 mg/dL. Blood tests are performed on 100 female Asian immigrants, the mean level mg/dL with standard deviation s=40 mg/dL

  • H0: µ = 190 vs Ha: µ ≠ 190
  • What is the pvalue?

52 . 181 = x

slide-47
SLIDE 47

Two-sided test:

  • 1. t value of sample statistic (observed)

Z

  • 2.12

12 . 2 100 / 40 190 52 . 181 / − = − = − = n s x t µ

slide-48
SLIDE 48

Two-sided test:

p-value is 2*P(t99 ≤ -2.12) =TDIST(2.12,99,2)=0.037< α t

  • 2.12

1/2 p-Value=.0185

slide-49
SLIDE 49

Two-sided test:

p-value is 2*P(t99 ≤ -2.12) =TDIST(2.12,99,2)=0.037< α Conclusion: the mean cholesterol level of recent Asian immigrants is significantly different from the mean for the general U.S. population Z 2.12

  • 2.12

1/2 p-Value=.0185 1/2 p-Value=.0185

slide-50
SLIDE 50

Relationship Between Hypothesis Testing and Confidence Intervals (2-sided case)

  • p-value tells exactly how significant results are
  • CI gives range of values that may contain µ

H0: µ = µ0 versus H1: µ = µ1 ≠ µ0 H0 is rejected with level α 100% × (1- α) CI does not contain µ0

slide-51
SLIDE 51

Hypothesis Tests vs. Confidence Intervals

There are three ways to test hypotheses (assume α = 0.05):

  • 1. By critical value method
  • 2. By computing p-value
  • 3. By constructing confidence interval
slide-52
SLIDE 52

EX Cardiovascular Disease ( two- sided t-test) CI method

  • Test the hypothesis that the mean cholesterol level of recent female

Asian immigrants is different from the mean in the general U.S. population 190 mg/dL. Blood tests are performed on 100 female Asian immigrants, the mean level mg/dL with standard deviation s=40 mg/dL

  • H0: µ = 190 vs Ha: µ ≠ 190

181.52 190 2.12 / 40 / 100 x t s n µ − − = = = −

181.52 x =

α =0.05, the critical values are t99, .025 =-TINV(0.05,99) = -1.98, so t99, .975=1.98. Then the 95% CI for µ is

Conclusion: since it does not include µ = 190, we conclude that the mean cholesterol level of recent Asian immigrants is significantly different from the mean for the general U.S. population

181.52 1.98*40 / 100 [173.6,189.4] ± =

slide-53
SLIDE 53

Hypothesis Testing: Two-Sample Inference

slide-54
SLIDE 54

We’ll learn…

  • How to use hypothesis testing for comparing the

difference between

  • 1. The means of two independent populations
  • 2. The means of two related populations
  • 3. The variances of two populations
slide-55
SLIDE 55

Two-sample Inference

Possible scenarios:

  • 1. Two independent samples
  • From two independent populations
  • 2. Paired samples:
  • Single population (before/after measurements)
  • Two related populations (matched pairs)
slide-56
SLIDE 56

Example

  • Let’s say we are interested in the relationship between use of oral

contraceptives (OC) and level of blood pressure (BP) in women. 1. Follow up non-OC users and measure the change when they become OC user :

  • Same patients: each woman is used as her own

control, so observed difference more likely to be due to OC use

  • Hard to follow up all patients
  • Expensive

Longitudinal study; paired samples from single population

slide-57
SLIDE 57

Example

  • Let’s say we are interested in the relationship between use of oral

contraceptives (OC) and level of blood pressure (BP) in women.

  • 2. Measure the difference in BP between a group of

OC users and a group of non-OC users:

  • The participants are seen at only one visit, could

be very different due to other factors such as age

  • Financially feasible

Cross-sectional: two independent samples

slide-58
SLIDE 58

The Paired t Test

slide-59
SLIDE 59

Related Populations: Paired t Test

  • Tests means of 2 related populations
  • Paired samples
  • Repeated measures (before/after)
  • Use difference between paired values
  • Assumptions:
  • Both populations are normally distributed
  • If not normal, use large samples (n>=30)
slide-60
SLIDE 60
  • Want to study the effect of OC on blood pressure.
  • Study design:
  • Recruit 10 women who are not using OC.
  • Follow-up after 1 year of using OC.
  • Interested in knowing BP difference.

Example

SBP Level: 10 women not using OC using OC Difference

(baseline)

1 115 128 13 2 112 115 3 3 107 106 -1 4 119 128 9 … … …. ….

slide-61
SLIDE 61

Mean Difference, σD Known

  • The ith paired difference is
  • The point estimate for the population mean paired difference is D :
  • Suppose the population standard deviation of the difference scores,

σD, is known

  • The test statistic for the mean difference is a Z value:

Di = X1i - X2i

D = Di

i=1 n

n

, n is the number of pairs in the paired sample

Z = D − µD σD n

Where µD = hypothesized mean difference σD = population standard dev. of differences n = the sample size (number of pairs)

slide-62
SLIDE 62
  • If σD is unknown, we can estimate the unknown population standard

deviation with a sample standard deviation:

  • Use a paired t test, the test statistic for D is now a t statistic, with n-1

d.f.:

1 n ) D (D S

n 1 i 2 i D

− − = ∑

=

Mean Difference, σD Unknown

t = D − µD SD n

slide-63
SLIDE 63

Lower-tail test: H0: µD = 0 H1: µD < 0 Upper-tail test: H0: µD = 0 H1: µD > 0 Two-tail test: H0: µD = 0 H1: µD ≠ 0

Hypothesis Testing for Mean Difference, σD Unknown

α α/2 α/2 α

  • tα/2

tα tα/2

Reject H0 if t < -tα Reject H0 if t > tα Reject H0 if t < -tα/2

  • r t > tα/2

Where t has n - 1 d.f.

slide-64
SLIDE 64

Confidence Interval

where n = the sample size (number of pairs in the paired sample)

  • The confidence interval for µD is

1. σD known 2. σD unknown

D − Z σD n , D + Z σD n      

D − tn−1 SD n D + tn−1 SD n      

slide-65
SLIDE 65

Paired t Test Example

SBP Level: 10 women not using OC using OC Difference, Di

1 115 128 13 2 112 115 3 3 107 106 - 1 4 119 128 9 5 115 122 7 6 138 145 7 7 126 132 6 8 105 109 4 9 104 102

  • 2

10 115 117 2

D = Di

n =4.8, SD = (Di − D)2

n −1 = 4.566

slide-66
SLIDE 66
  • Has the use of OC made a difference in their blood pressure

(at the 0.01 level)? H0: µD = 0 H1: µD ≠ 0

Critical Value = ± 2.26 d.f. = 10 - 1 = 9 Reject α/2

t9,0.025 t9,0.975

  • 2.26 2.26

Paired t Test: Solution

Reject α/2

α = .01 EXCEL: t9,0.975 =TINV(0.05,9)=2.26

slide-67
SLIDE 67
  • Has the use of OC made a difference in their blood pressure

(at the 0.01 level)? H0: µD = 0 H1: µD ≠ 0

Test Statistic: Critical Value = ± 2.26 d.f. = 10 - 1 = 9 Reject α/2

t9,0.025 t9,0.975

  • 2.26 2.26

Paired t Test: Solution

Reject α/2

3.32

α = .01

t = D − µD SD/ n = 4.8 − 0 4.566/ 10 = 3.32

EXCEL: t9,0.975 =TINV(0.05,9)=2.26

slide-68
SLIDE 68
  • Has the use of OC made a difference in their blood pressure

(at the 0.01 level)? 4.8 D = H0: µD = 0 H1: µD ≠ 0

Reject α/2

  • 2.26 2.26

Decision: reject H0

(t stat is in the reject region)

Conclusion: There is a significant change in the blood pressure.

Paired t Test: Solution

Reject α/2

3.32

α = .01

Test Statistic: Critical Value = ± 2.26 d.f. = 10 - 1 = 9

3.32

t = D − µD SD/ n = 4.8 − 0 4.566/ 10 = 3.32

slide-69
SLIDE 69

Confidence Interval for the True Difference (µD) Between the Underlying means of Two Paired Samples So in the above example: 95% Confidence Interval is [1.53, 8.07]

slide-70
SLIDE 70

Install the Excel 2007 Analysis ToolPak

http://www.dummies.com/how-to/content/how-to- install-the-excel-2007-analysis-toolpak.html

Although the Analysis ToolPak comes with Excel 2007, it doesn’t come pre-installed. Follow the following link to install it in Excel. After installation, please restart Excel, then you will see the Data Analysis button in the Analysis group added to the end of the Ribbon’s Data tab.

slide-71
SLIDE 71

EXCEL Paired T-test Analysis

  • EXCELDataData Analysist-Test: Paired

Two Sample for Means

slide-72
SLIDE 72

EXCEL Paired T-test Analysis Results

t-Test: Paired Two Sample for Means Variable 1 Variable 2 Mean 120.4 115.6 Variance 174.9333 106.2667 Observations 10 10 Pearson Correlation 0.954777 Hypothesized Mean Difference df 9 t Stat 3.324651 P(T<=t) one-tail 0.004437 t Critical one-tail 1.833113 P(T<=t) two-tail 0.008874 t Critical two-tail 2.262157

slide-73
SLIDE 73

Independent Samples

slide-74
SLIDE 74

Independent Samples

  • Different data sources
  • Unrelated
  • Independent
  • Sample selected from one population has no

effect on the sample selected from the other population

  • Goal: Test hypothesis or form a confidence interval for

the difference between two population means, µ1 –µ2 The point estimate for the difference is X1 – X2

slide-75
SLIDE 75

Difference Between Two Means

Population means, independent samples σ1 and σ2 known σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

slide-76
SLIDE 76

Difference Between Two Means

Population means, independent samples σ1 and σ2 known

Use a Z test statistic Use Sp to estimate unknown σ , use a t test statistic and pooled standard deviation

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

Use S1 and S2 to estimate unknown σ1 and σ2 , use a separate-variance t test

slide-77
SLIDE 77

Population means, independent samples σ1 and σ2 known

σ1 and σ2 Known

Assumptions:

  • Samples are randomly and

independently drawn

  • Population distributions are

normal or both sample sizes are ≥ 30

  • The test statistic is a Z-value…
  • Population standard deviations

are known

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

slide-78
SLIDE 78

Population means, independent samples σ1 and σ2 known

…and the standard error of X1 – X2 is

σ X1−X2 = σ1

2

n1 + σ 2

2

n2

(continued)

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

σ1 and σ2 Known

slide-79
SLIDE 79

Population means, independent samples σ1 and σ2 known

Z = X1 − X2

( )

− µ1 − µ2

( )

σ1

2

n1 + σ 2

2

n2

The test statistic for µ1 –µ2 is:

(continued)

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

σ1 and σ2 Known

slide-80
SLIDE 80

Hypothesis Tests for Two Population Means

Lower-tail test: H0: µ1 = µ2 H1: µ1 < µ2 i.e., H0: µ1 – µ2 = 0 H1: µ1 – µ2 < 0 Upper-tail test: H0: µ1 = µ2 H1: µ1 > µ2 i.e., H0: µ1 – µ2 = 0 H1: µ1 – µ2 > 0 Two-tail test: H0: µ1 = µ2 H1: µ1 ≠ µ2 i.e., H0: µ1 – µ2 = 0 H1: µ1 – µ2 ≠ 0 Two Population Means, Independent Samples

slide-81
SLIDE 81

Lower-tail test: H0: µ1 – µ2 = 0 H1: µ1 – µ2 < 0 Upper-tail test: H0: µ1 – µ2 = 0 H1: µ1 – µ2 > 0 Two-tail test: H0: µ1 – µ2 = 0 H1: µ1 – µ2 ≠ 0

α α/2 α/2 α

  • zα/2

zα zα/2 Reject H0 if Z < -Zα Reject H0 if Z > Zα Reject H0 if Z < -Zα/2

  • r Z > Zα/2

Hypothesis tests for µ1 – µ2

slide-82
SLIDE 82

Population means, independent samples σ1 and σ2 known X1 − X2

( )± Z

σ1

2

n1 + σ 2

2

n2

  • The confidence interval for

µ1 –µ2 is:

Confidence Interval, σ1 and σ2 Known

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

slide-83
SLIDE 83

Population means, independent samples σ1 and σ2 known

σ1 and σ2 Unknown,

Assumed Equal

Assumptions:

  • Samples are randomly and

independently drawn

  • Populations are normally

distributed or both sample sizes are at least 30

  • Population variances are

unknown but assumed equal

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

slide-84
SLIDE 84

Population means, independent samples σ1 and σ2 known

(continued) Forming interval estimates:

  • The population variances are

assumed equal, so use the two sample variances and pool them to estimate the common σ2

  • The pooled variance

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

σ1 and σ2 Unknown,

Assumed Equal

Sp

2 =

n1 −1

( )S1

2 + n2 −1

( )S2

2

(n1 −1) + (n2 −1)

slide-85
SLIDE 85

Population means, independent samples σ1 and σ2 known

t = X1 − X2

( )

− µ1 − µ2

( )

Sp

2 1

n1 + 1 n2      

  • The test statistic for µ1 –µ2 is a t

value with (n1 + n2 – 2) degrees of freedom (continued)

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

σ1 and σ2 Unknown,

Assumed Equal

slide-86
SLIDE 86

Population means, independent samples σ1 and σ2 known

X1 − X2

( )± tn1+n2 -2

Sp

2

1 n1 + 1 n2      

  • The confidence interval for

µ1 –µ2 is:

Confidence Interval, σ1 and σ2 Unknown

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

slide-87
SLIDE 87

Pooled-Variance t Test: Example

Example: Compare the mean systolic pressure between OC and non-OC users.

Assuming both populations are approximately normal with equal variances, is there a difference in average SBP (α = 0.05)?

SBP level ID not using OCs using OC 1 115 128 2 112 115 3 107 106 4 119 128 5 115 122 6 138 145 7 126 132 8 105 109 9 104 102 10 115 117

slide-88
SLIDE 88

EXCEL DATA Analysis

  • With raw data, we can perform the t-test using

the following analysis

  • EXCELDataData Analysist-Test: Two

Sample Assuming Equal Variances

slide-89
SLIDE 89

EXCEL T-test Analysis Results

t-Test: Two-Sample Assuming Equal Variances Variable 1 Variable 2 Mean 115.6 120.4 Variance 106.2666667 174.9333333 Observations 10 10 Pooled Variance 140.6 Hypothesized Mean Difference df 18 t Stat

  • 0.905177144

P(T<=t) one-tail 0.188664198 t Critical one-tail 1.734063592 P(T<=t) two-tail 0.377328397 t Critical two-tail 2.100922037

Sample results

slide-90
SLIDE 90

Solution

  • H0: µ1 – µ2 = 0
  • Ha: µ1 – µ2 ≠ 0
  • α = 0.05
  • df = (10-1)+(10-1)=18
  • Critical Value(s): 2.1

TINV(0.05, 18)=2.1

  • Test Statistic: -0.91
  • Decision:

Do not reject at α = 0.05

  • Conclusion:

we conclude that the mean blood pressures of the OC an d non-OC groups do not significantly differ from each

  • ther.

Pvalue=0.38>0.05, do not reject H0 t

2.1

  • 2.1

.025

Reject H0

.025

Reject H0

slide-91
SLIDE 91

Calculating the Test Statistic

( ) ( ) ( ) ( )

− + − − + − = = = − + − + −

2 2 1 1 2 2 2 p 1 2

n 1 S n 1 S 10 1 106.3 10 1 174.9 S 140.6 (n 1) (n 1) (10-1) (10 1)

( ) (

) ( )

µ µ − − − − − = = =     + +        

1 2 1 2 2 p 1 2

X X 115.6 120.4 t

  • 0.91

1 1 1 1 140.6 S 10 10 n n

The test statistic is:

slide-92
SLIDE 92

Population means, independent samples σ1 and σ2 known

σ1 and σ2 Unknown,

Not Assumed Equal

Assumptions:

  • Samples are randomly and

independently drawn

  • Populations are normally

distributed or both sample sizes are at least 30

  • Population variances are

unknown but cannot be assumed to be equal

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

slide-93
SLIDE 93

Population means, independent samples σ1 and σ2 known

t = X1 − X2

( )

− µ1 − µ2

( )

S1

2

n1 + S2

2

n2

  • The test statistic for µ1 –µ2 is:

(continued)

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

σ1 and σ2 Unknown, Unequal variances

slide-94
SLIDE 94

Population means, independent samples σ1 and σ2 known

(continued) Forming the test statistic:

  • The population variances are not

assumed equal, so include the two sample variances in the computation of the test statistic

  • The test statistic can be

approximated by a t distribution with v degrees of freedom (see next slide)

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

σ1 and σ2 Unknown,

Not Assumed Equal

slide-95
SLIDE 95

Population means, independent samples σ1 and σ2 known

  • The number of degrees of freedom

is the integer portion of: (continued)

ν = S1

2

n1 + S2

2

n2      

2

S1

2

n1      

2

n1 −1

( )+

S1

2

n1      

2

n2 −1

( )

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

σ1 and σ2 Unknown, Assumed Unequal (Satterthwaite’s method)

slide-96
SLIDE 96

Population means, independent samples σ1 and σ2 known

  • The confidence interval for

µ1 –µ2 is:

(continued)

σ1 and σ2 unknown, assumed equal σ1 and σ2 unknown, not assumed equal

σ1 and σ2 Unknown, Unequal variances

X1 − X2

( )± tν

S1

2

n1 + S2

2

n2

slide-97
SLIDE 97

Unequal Variances: Example

Example: Compare the mean systolic pressure between OC and non-OC users.

Assuming both populations are approximately normal with unequal variances, test for the equality of the mean cholesterol levels of the children Group1 and Group2 (α = 0.05).

SBP level ID not using OCs using OC 1 115 128 2 112 115 3 107 106 4 119 128 5 115 122 6 138 145 7 126 132 8 105 109 9 104 102 10 115 117

slide-98
SLIDE 98

EXCEL DATA Analysis

EXCELDataData Analysist-Test: Two Sample Assuming Unequal Variances

slide-99
SLIDE 99

EXCEL DATA Analysis

t-Test: Two-Sample Assuming Unequal Variances Variable 1 Variable 2 Mean 115.6 120.4 Variance 106.2667 174.9333 Observations 10 10 Hypothesized Mean Difference df 17 t Stat

  • 0.90518

P(T<=t) one-tail 0.189011 t Critical one-tail 1.739607 P(T<=t) two-tail 0.378022 t Critical two-tail 2.109816

slide-100
SLIDE 100

Solution

  • H0: µ1 – µ2 = 0
  • Ha: µ1 – µ2 ≠ 0
  • α = 0.05
  • Degree of freedom??
  • Critical Value(s):
  • Test Statistic:
  • Decision:
  • Conclusion:
slide-101
SLIDE 101

Solution

  • H0: µ1 – µ2 = 0
  • Ha: µ1 – µ2 ≠ 0
  • α = 0.05
  • Degree of freedom=17
  • Critical Value(s):

from the Table 5, t17,0.975=2.11

  • Test Statistic:
  • 0.91
  • Decision:

reject at α = 0.05

  • Conclusion:

we conclude that the mean blood pressures of the OC and non-OC groups do not significantly differ from each ot her. .

t

0 2.11

  • 2.11

.0025

Reject H0

.0025

Reject H0

slide-102
SLIDE 102

Calculating the degree of freedom

The d.f (integer portion) is: 17

( ) ( )

ν   +     =     − + −           +     =     +        

2 2 2 1 2 1 2 2 2 2 2 1 1 1 2 1 1 2 2 2

S S n n S S n 1 n 1 n n 106.27 174.93 10 10 = 17 106.27 174.93 9 9 10 10

( ) (

) ( )

µ µ − − − = + − − = = +

1 2 1 2 2 2 1 2 1 2

X X t S S n n 174. 10 93

  • 0.91

174.93 10 1 6.27 106.27

  • Test Statistic:
slide-103
SLIDE 103

Comparing population variances: F test

slide-104
SLIDE 104

Testing for the equality of Two Variances

  • Suppose that we have two independent samples from a N(µ1,

σ1

2) and N(µ2, σ2 2) populations, respectively.

  • We want to test the following hypotheses:
  • H0: σ1

2 = σ2 2

  • H1: σ1

2 ≠ σ2 2

  • Test Statistic (based on the F-distribution):
  • Reject H0 if the variance ratio is either too large (>> 1) or too

small (<< 1) and accept otherwise

  • Follows the F-distribution (Fisher, Snedecor)

S1

2

S2

2

slide-105
SLIDE 105

F distribution

  • follows F distribution under H0: σ1

2 = σ2 2

  • F is a family of distributions, parameterized by df1 = n1-1 and df2 =

n2-1

  • Denoted
  • Always positive

(generally positively skewed)

  • Reject if

F = S1

2

S2

2

F = S1

2

S2

2 ~ F n1−1,n2 −1

F > F

n1−1,n2 −1,1−α /2 or F < F n1−1,n2 −1,α /2

slide-106
SLIDE 106

F Test for Two Variances Critical Values

Rejection region Rejection region Acceptation region

2 / , 1 , 1

2 1

α − − n n

F

2 / 1 , 1 , 1

2 1

α − − − n n

F

F > F

n1−1,n2 −1,1−α /2 or F < F n1−1,n2 −1,α /2

Reject if

slide-107
SLIDE 107

Unequal Variances: Example

Example: Compare the mean systolic pressure between OC and non-OC users.

Test for the equality of the two variances (α = 0.05).

SBP level ID not using OCs using OC 1 115 128 2 112 115 3 107 106 4 119 128 5 115 122 6 138 145 7 126 132 8 105 109 9 104 102 10 115 117

slide-108
SLIDE 108

EXCEL DATA Analysis

  • EXCELDataData AnalysisF-Test: Two

Sample for Variances

  • Sample Output

F-Test Two-Sample for Variances Variable 1 Variable 2 Mean 120.4 115.6 Variance 174.9333 106.2667 Observations 10 10 df 9 9 F 1.646173 P(F<=f) one-tail 0.234645 F Critical one-tail 3.178893

NOTE:

  • This Excel procedure is only for one-

sided test.

  • If the test is two-sided you have two
  • ptions. First, you can divide the given

value of by 2, and input the result as the level of significance. The second

  • ption is to always use the p-value

criterion and for a two-sided test, multiply the one-sided p-value by 2.

α

slide-109
SLIDE 109

Two Sample Inference

  • Two independent populations or paired samples?
  • Paired samples:
  • Paired z-test (if σ known) or paired t-test (if σ unknown) based
  • n observed differences
  • Independent samples:
  • z-test if population variances are given
  • Otherwise,
  • F test to determine if population variances can be assumed equal
  • If yes, t-test with pooled estimate of variance
  • If no, t-test with separate estimates of variance