Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 - ) Confidence...

31
Fall 2002 Biostat 511 1 Statistical Inference - Confidence Intervals General (1 - ) Confidence Intervals: a random interval that will include a fixed (but unknown) parameter (1 - ) of the time CI for , assumed known: confidence wider interval sample size smaller SE narrower interval n n / 96 . 1 X , / 96 . 1 X

Transcript of Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 - ) Confidence...

Page 1: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 1

Statistical Inference - Confidence Intervals

• General (1 - ) Confidence Intervals: a random interval that will include a fixed (but unknown) parameter (1 - ) of the time

• CI for , assumed known: confidence wider interval sample size smaller SE narrower interval

nn /96.1X,/96.1X

Page 2: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 2

Page 3: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 3

Confidence Intervals

Q: When we do not know the population parameter, how can we use the sample to estimate the population mean, and use our knowledge of probability to give a range of values consistent with the data?

Parameter:

Estimate:

Given a normal population, or large sample size, we can state:

X

95.096.1/

96.1

n

XP

Note: this is not n

n

Page 4: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 4

Confidence Intervals

We can do some rearranging:

The interval

is called a 95% confidence interval for .

95.096.1/

96.1

n

XP

95.0/96.1/96.1 nXnP

95.0/96.1/96.1 nXnXP

95.0/96.1/96.1 nXnXP

nn /96.1X,/96.1X

Interpretation: If we repeat this procedure 100 times, the interval constructed in this manner will include the true mean () 95 times.

Page 5: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 5

Confidence Intervals known

When is known we can construct a confidence interval for the population mean, , for any given confidence level, (1 - ). Instead of using 1.96 (as with 95% CI’s) we simply use a different constant that yields the right probability.

So if we desire a (1 - ) confidence interval we can derive it based on the statement

That is, we find constants and that have exactly (1 - ) probability between them.

A (1 - ) Confidence Interval for the Population Mean

1/

21

2ZZ Q

nX

QP

2

ZQ

21

ZQ

nQX

nQX ZZ

2

12 ,

nQX

nQX ZZ

2

12

1

,or, equivalently,

Page 6: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 6

Confidence Intervals known - EXAMPLE

Suppose gestational times are normally distributed with a standard deviation of 6 days. A sample of 30 second time mothers yield a mean pregnancy length of 279.5 days. Construct a 90% confidence interval for the mean length of second pregnancies based on this sample.

Page 7: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 7

Summary

• General (1 - ) Confidence Intervals:

(statistic + Q(/2)SEstatistic , statistic + Q(1-/2)SEstatistic)

• CI for , assumed known Z.

confidence wider interval

sample size smaller SE narrower interval

Page 8: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 8

Statistical Inference - Hypothesis Testing

•Null Hypothesis•Alternative Hypothesis•Significance level•Statistically significant•Critical value•Acceptance / rejection region•p-value•power•Types of errors: Type I (), Type II ()•One-sided (one-tailed) test•Two-sided (two-tailed) test

Page 9: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 9

The ideas in hypothesis testing are based on deductive reasoning - we assume that some probability model is true and then ask “What are the chances that these observations came from that probability model?”.

Page 10: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 10

Hypothesis TestingMotivation

A coin is flipped 50 times. Of the 50 flips, 45 are heads. Do you think it is a fair coin?

(what do we mean by a fair coin?)

(what is your reasoning behind a yes or no answer?)

Page 11: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 11

Fra

ctio

n

x5 7 9 111315171921232527293133353739414345

0

.05

.1

Page 12: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 12

Hypothesis TestingMotivation

Among 20-74 year-old males the mean serum cholesterol is 211 mg/ml with standard deviation of 46 mg/ml.

In a sample of 25 hypertensive men we find a mean serum-cholesterol level ( ) of 220 mg/ml.

Is this strong enough evidence to convince us that the mean for the population of hypertensive men differs from 211 mg/ml?

•Is the data consistent with that model?

•What if = 230 mg/ml?

•What if = 250 mg/ml?

•What if the sample was of 100 instead of 25?

X

X

X

Page 13: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 13

Hypothesis Testing

Define:

= population mean serum cholesterol for male hypertensives

Hypotheses:

1. Null Hypothesis: Generally, the hypothesis that the unknown parameter equals a fixed value.

H0: = 211 mg/ml

2. Alternative Hypothesis: contradicts the null hypothesis.

HA: 211 mg/ml

Typically, the alternative hypothesis is the thing you are trying to prove. The null hypothesis is a “straw man”. There is a reason for this, as we will see in a moment.

Page 14: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 14

Hypothesis Testing

Decision / Action:

Either H0 or HA must be true. Based on the data we will choose one of these hypotheses. But what if we choose wrong?! What is the probability of that happening?

H0 Correct HA Correct

Decide H0

1-

(type II error)

Decide HA

(type I error)

1-

= significance level

= P(reject H0 | H0 true)

1- = power

= P(reject H0 | HA true)

Let’s construct a procedure that will help us decide between the two hypotheses …

Page 15: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 15

Hypothesis Testing

*** Suppose Ho is true ***

Then the sample mean ( ) for cholesterol should be “near” 0 = 211 mg/ml. Since is normally distributed with std. error , this suggests that, if H0 is true, then

should be near 0.

X

n/

n

XZ o

/

X

-4 -2 0 2 4

0

.1

.2

.3

.4

Distribution of Z if H0 is true

Notice that, if H0 is true, then -1.96 < Z < 1.96, 95% of the time and |Z| > 1.96 only 5% of the time.

Page 16: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 16

Hypothesis Testing

Suppose we decide to reject H0 if |Z| > 1.96; then P[reject H0 | H0 true] = 0.05. In other words, we would only make a type I error 5% of the time.

More generally, suppose we want P[reject H0 | H0 true] = ; then our rule should be reject H0 if |Z| > . The type I error rate is .

21 ZQ

Given and H0 we can construct a test of H0 with a specified significance level (we can’t eliminate the possibility of making an error, but we can control it). But remember, we start by assuming that H0 is true - we haven’t proved it is true. Therefore, we usually say

• if |Z| > 1.96 then we reject H0.

• if |Z| < 1.96 then we fail to reject H0.

Page 17: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 17

Hypothesis Testing

Let’s review what we’ve just done ….

1) I made an assumption - the null hypothesis is true (therefore Z ~ N(0,1))

2) I determined if the data was consistent with that assumption (is it plausible that my observed Z came from a N(0,1) distribution?)

3) If the data are not consistent with the assumption, I conclude that

• either H0 is true and something unusual happened (with probability )

• or, H0 is not true.

This 3-step procedure is the basis of all hypothesis tests, but …

different hypotheses different details

Page 18: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 18

Hypothesis Testing

Cholesterol Example:

Let be the (true but unknown population) mean serum cholesterol level for male hypertensives. We observe

= 220 mg/ml

Also, we are told that for the general population...

0 = mean serum cholesterol level for males = 211 mg/ml

= std. dev. of serum cholesterol for males = 46 mg/ml

NULL HYPOTHESIS: mean for male hypertensives is the same as the general male population.

ALTERNATIVE HYPOTHESIS: mean for male hypertensives is different than the mean for the general male population.

H0 : = 0 = 211 mg/ml

HA : 0 ( 211 mg/ml)

X

Page 19: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 19

Hypothesis Testing

Cholesterol Example:

Test H0 with significance level .

Under H0 we know:

Therefore,

•Reject H0 if > 1.96 gives an = 0.05 test.

•Reject H0 if

1 ,0~/

Nn

X o

n

X

/0

96.1

or 96.1

0

0

nX

nX

Page 20: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 20

Hypothesis Testing

Cholesterol Example:

TEST: Reject H0 if

In terms of Z ...

25

4696.1211

or 25

4696.1211

X

X

192.97

or 03.228

X

X

n

XZ

/0

Reject H0 if Z < -1.96 or Z > 1.96

Page 21: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 21

Mean serum cholesterol180 200 220 240

0

.02

.04

Rejection region

Page 22: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 22

Hypothesis Testing

p-value:

• smallest possible for which the observed sample would still reject H0.

• probability of obtaining a result as extreme or more extreme than the actual sample (given H0 true).

NOTE: probability calculations are always based on a model.

Page 23: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 23

Hypothesis Testing

p-value: Cholesterol Example

= 220 mg/ml n = 25 = 46 mg/ml

H0 : = 211 mg/ml

HA : 211 mg/ml

What value of would cause us to reject Ho? Need to find the value of that corresponds to the observed (Z). The p-value is given by:

2 * P[ > 220] =

2 * P[Z > 0.978] = .33

X

X

Mean serum cholesterol180 200 220 240

0

.02

.04

21 ZQ

X

Page 24: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 24

Determination of Statistical Significance for Results from Hypothesis Tests

Either of the following methods can be used to establish whether results from hypothesis tests are statistically significant:

(1) The test statistic Z can be computed and compared with the critical value at an level of .05. Specifically, if H0: = 0 versus H1: 0 are being tested and |Z| > 1.96, then H0 is rejected and the results are declared statistically significant (i.e., p < .05). Otherwise, H0 is accepted and the results are declared not statistically significant (i.e., p .05). We refer to this approach as the critical-value method.

(2) The exact p-value can be computed, and if p < .05, then H0 is rejected and the results are declared statistically significant . Otherwise, if p .05 then H0 is accepted and the

results are declared not statistically significant . We will refer to this approach as the p-value method .

21 ZQ

Page 25: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 25

Guidelines for Judging the Significance of p-value (Rosner pg 200)

If .01 < p < .05, then the results are significant.

If .001 < p < .01, then the results are highly significant.

If p < .001, then the results are very highly significant.

If p > .05, then the results are considered not statistically significant (sometimes denoted by NS).

However, if .05 < p < .10, then a trend toward statistically significance is sometimes noted.

Page 26: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 26

Hypothesis Testing and Confidence Intervals

Confidence Interval: “Plausible” values for are given by

If the null hypothesis value of (namely, 0) is not in this interval, then it is not “plausible” and should be rejected.

nQX

nQX ZZ

21

21

In fact, this relationship is exact –

1) any value for that is not in an -level confidence interval will be rejected by a -level hypothesis test.

2) an -level confidence interval for consists of all possible values of 0 that would not be rejected in a -level hypothesis test.

Page 27: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 27

Hypothesis Testing“how many sides?”

Depending on the alternative hypothesis a test may have a one-sided alternative or a two-sided alternative. Consider

H0 : = 0

We can envision (at least) three possible alternatives

HA : 0 (1)

HA : < 0 (2)

HA : > 0 (3)

(1) is an example of a “two-sided alternative”

(2) and (3) are examples of “one-sided alternatives”

The distinction impacts

• Rejection regions

• p-value calculation

Page 28: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 28

Hypothesis Testing“how many sides?”

Cholesterol Example: Instead of the two-sided alternative considered earlier we may have only been interested in the alternative that hypertensives had a higher serum cholesterol.

H0 : = 211

HA : > 211

Given this, an = 0.05 test would reject when

We put all the probability on “one-side”.

The p-value would be half of the previous,

p-value = P[ > 220]

= .163

65.1/

05.010

ZQZn

X

X

Page 29: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 29

Mean serum cholesterol180 200 220 240

0

.02

.04

Page 30: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 30

Hypothesis Testing

Through this worked example we have seen the basic components to the statistical test of a scientific hypothesis.

Summary

1. Identify H0 and HA

2. Identify a test statistic

3. Determine a significance level, = 0.05, = 0.01

4. Critical value determines rejection / acceptance region

5. p-value

6. Interpret the result

Page 31: Fall 2002Biostat 511186 Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.

Fall 2002 Biostat 511 31

Hypothesis Testing

•Null Hypothesis

•Alternative Hypothesis

•Significance level

•Statistically significant

•Critical value

•Acceptance / rejection region

•p-value

•power

•Types of errors: Type I (), Type II ()

•One-sided (one-tailed) test

•Two-sided (two-tailed) test