Inference Basics Since about of the samples are if we create intervals based on a sample mean, x,...

48
Inference Basics : size of samples for n x m Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by , then of the time, we’ll create an interval that . We say “we are confident that m lies between and x m 2 x m 2 1

Transcript of Inference Basics Since about of the samples are if we create intervals based on a sample mean, x,...

Page 1: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

1

Inference Basics

: size of samplesfor nx

m

Since about of the samples are

if we create intervals based on a sample mean, x, and

go up and down by , then of the

time, we’ll create an interval that .

We say “we are confident that m lies between

and ”.

x 2 x 2

Page 2: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

2

Confidence Interval (CI)

Level of confidence: with repeated samples the probability the interval will contain the true parameter value.

Step 1: find an estimate for the parameter (the statistic) Step 2: find the margin of error (creating a range of values)

Three conditions: SRS, Normal dist., and σ is known.

Estimate for mean:

Estimate for margin of error :

Page 3: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

3

CI – on the calculator

xx )many so(

nzx

*

Confidence Interval: Estimate ± margin of error

On calculator: STAT, TESTS, 7:ZInterval

Given data, need to enter: s, List location, C-Level

Given stats, need to enter: s, x, n, C-Level

Select input (Data or Stats), enter appropriate info, then Calculate

Page 4: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

4

Ex 1 . My jogging times for a 3 mile loop around campus has a known s = 2.7 min. In a random sample of 90 of these recorded times, the mean time was 22.6 minutes. Find a 95% C.I. for m.

:error ofmargin

conclude We

Given stats, need to enter: =2.7s , x=22.6, n=90, C-Level=.95

:Interval-z

Page 5: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

5

Ex 2 . A certain breed of hummingbirds is being studied in southeast GA. A small group of 15 are tagged and weighed. Based on past studies, we assume weights are Normally distributed with s = 1.1 g. Find a 90% C.I. for m with

Weights = 2, 2, 2, 2, 2, 2, 3, 3, 3.25, 3.5, 4, 4, 4.5, 5, 5

:error ofmargin conclude We

Given data, need to enter: data in List, =1.1s , C-Level=.90

:Interval-z

Page 6: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

6

Ex 3 . The average high temperature in November in Savannah for the past 40 years averaged 71.16 degrees. Assume average high temperatures are Normally distributed with s = 3° F. Find 90% and 95 % CI.

:error ofmargin conclude We

Given stats, need to enter: =3s , x=71.16, n=40, C-Level=.90

:Interval-z

Page 7: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

7

Ex 3 – Continued – Find 90% and 95 % CI.

:error ofmargin conclude We

Given stats, need to enter: =3s , x=71.16, n=40, C-Level=.95

:Interval-z

:confidence increasing ofResult

Page 8: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

8

Ex 4 . A sample of 20 pumpkins averaged 9.2 pounds. Assume weights are Normally distributed with s = 1.5 lb. Find a 92% CI.

Given stats, need to enter: =1.5s , x=9.2, n=20, C-Level=.92

:Interval?-z

Page 9: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

9

Significance Tests

Someone makes a claim that you do not believe. So you look for evidence against the claim (supporting

your belief). If the claim were true, then how likely would it be to see a

random sample behave the way it did? Assume parameter (mean) is distributed Normally

-1 0 1 2 3-2-3

Page 10: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

10

Significance Tests – Steps State parameter being tested

State hypotheses: H0, the null hypothesis, usually no effect

Ha, the alternative, claim for which you are

trying to find evidence to support

Compute test statistic: if the null hypothesis is true, where

does the sample fall? Test stat = z-score

Compute p-value: what is the probability of seeing a test stat

as extreme (or more extreme) as that?

Conclusion: small p-values lead to strong evidence against H0.

Page 11: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

11

Significance Tests – Hypotheses H0, the null hypothesis, usually no effect.

Ha, the alternative, claim for which you are trying to find evidence to support.

Three kinds of alternatives:

Page 12: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

12

Levels of Significance, α

α = .005

α = .01

α = .05

α = .10

Perform a significance test and get p-value of .037:

Page 13: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

13

ST – on the calculator

On calculator: STAT, TESTS, 1:Z –Test

Given data, need to enter: m0, s, List location, Ha

Given stats, need to enter: m0, s, x, n, Ha

Select input (Data or Stats), enter appropriate info, then Calculate or Draw

Output: Test stat, p-value

Page 14: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

14

Ex 5. Nationally, about 11% of the wheat crop is destroyed by hail. An insurance company investigates whether GA crops suffered damage different from the national average, N(11, 5). 16 GA claims of damage had a mean of 12.5% crop damage.

:

:0

aH

H

z:statTest

-1 0 1 2 3-2-3

:value p

:conclusion

Page 15: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

15

Ex 6. A car manufacturer advertises a new car that gets 47 mpg. You suspect the manufacturer is exaggerating the mileage. A sample of 20 cars were tested and found to have a mean mpg of 45.2 miles per gallon. If s = 2.7, is there evidence at the 1% significance level that the manufacturer is overstating mpg?

:

:0

aH

H

z:statTest

-1 0 1 2 3-2-3

:value p

:conclusion

Page 16: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

16

Ex 7. The mean running time for a certain type of battery has been 9.8 hours. The manufacturer has introduced a change in the production method and wants to perform a test to determine whether the mean running time has increased. Assume s = 2.1 hours and the sample mean of 40 batteries was 10.6 hours.

:

:0

aH

H

z:statTest

-1 0 1 2 3-2-3

:value p

:conclusion

Page 17: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

17

Ex 8. A laboratory tested 12 chicken eggs from a local farm and found the mean amount of cholesterol was 230 mg. You believe this is significantly lower than the stated mean value for cholesterol in eggs, 240 mg, with s = 19.9 mg. Test your claim.

data= 200, 200, 210, 220, 230, 235, 235, 240, 240, 245, 250, 255

:

:0

aH

H

z:statTest -1 0 1 2 3-2-3

:value p

:conclusion

Page 18: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

18

More with Inference

Three conditions: SRS, Normal dist., and σ is known.

xx )many so(

nzx

*

Confidence Interval: Estimate ± margin of error

testedbeingmean population

00 : H

Significance Test:

n

xxz

x /:StatTest 00

Page 19: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

19

Changing margin of error

Margin of error =

Decrease margin of error by:

nz

*

Page 20: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

20

Deciding on sample sizeIf you want a margin of error at a certain level, m,

what sample size is needed for a given confidence level?

*,,:Given zmMargin of error =

Page 21: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

21

Deciding on z*If you want a given confidence level, how do you get z*?

-1 0 1 2 3-2-3

-1 0 1 2 3-2-3

Page 22: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

22

ExampleA 99% C.I. is [18.8, 48.0] for the mean duration of

imprisonment in months.

(a) What is the margin of error?

(b) What does that say about estimating mean duration?

(c) What minimum sample size is needed if you want a margin of error of at most 12 months (with 99% confidence and σ = 35 months)?

A sample size of is required.

Page 23: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

23

Example-continued(d) Create a 99% C.I. from a random sample of 57 prisoners.

Given stats, need to enter:

= 35s , x = 34.2, n = 57, C-Level=.99

:error ofmargin

:Interval-z

Page 24: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

24

Ex 3 – Find 95 % CI for temperature.

:error ofmargin

Given stats: =3s , x=71.16, n=40, C-Level=.95

93.23.7016.71 :Interval-z 72.09) ,23.70(

Savannahin Novin high temp averagemean

What minimum sample size is needed if you want a margin of error of at most .75 degrees with 95% confidence?

A sample size of is required.

Page 25: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

25

Error in Significance TestsType I: If we reject H0 when, in fact, H0 is true.

Type II: If we fail to reject H0, when, in fact, Ha is true.

Perform a test: H0: μ = 4; Ha: μ >4If evidence says to reject H0, and μ=4, then

If evidence says to reject H0, and μ>4, then

If evidence says to not reject H0, and μ=4, then

If evidence says to not reject H0, and μ>4, then

Page 26: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

26

Ex 7 – The mean running time for a certain type of battery has been 9.8 hours. The manufacturer has introduced a change in production and wants to perform a test to determine whether the mean running time has increased. Assume s = 2.1 hours and the sample mean of 40 batteries was 10.6 hours.

:

:0

aH

H z:statTest 41.2 :value p 0080.

.Hreject toevidence strong is There 0

battery new of timerunningmean

.89

8.9

:conclusion

If, in fact, the mean running time is equal to 10.1, then your conclusion would be classified as a:

Type I error Type II error correct decision

Page 27: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

27

Ex 8 – A laboratory tested 12 chicken eggs from a local farm and found the mean amount of cholesterol was 230 mg. You believe this is significantly lower than the stated mean value for cholesterol in eggs, 240 mg, with s = 19.9 mg. Test your claim.

:

:0

aH

H z:statTest 74.1 :value p 0409.

.Hreject toevidenceenough is There 0

eggsin level lcholesteromean

240

240

:conclusion

If, in fact, the mean cholesterol level is equal to 240, then your conclusion would be classified as a:

Type I error Type II error correct decision

Page 28: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

28

Inference for One Sample Mean

Confidence Interval: Estimate ± margin of error

State parameter being tested State hypothesesCompute test statisticCompute p-valueConclusion

Significance Test:

Page 29: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

29

AssumptionsThree conditions: SRS, Normal dist., and σ is known.

Now:

Which means is no longer used.

Instead of: We’ll use:

nx

x

xz

0

Page 30: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

30

t-distributions

Not quite Normal, still symmetric and bell-shaped,

gets closer to Normal curve as sample size increases

-1 0 1 2 3-2-3

Page 31: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

31

.)S.E)(many so(x

n

stx *

Confidence Interval: Estimate ± margin of error

On calculator: STAT, TESTS, 8:TInterval

Given data, need to enter: List location, C-Level

Given stats, need to enter: x, s, n, C-Level

Select input (Data or Stats), enter appropriate info, then Calculate

Page 32: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

32

Ex 9. An adult patient has been treated for tetany, severe muscle spasms. This condition is associated with low levels of calcium, an average less than 6 mg/dl. Based on 10 recent calcium tests, find a 99.9% C.I. for m.

9.3 8.8 10.1 8.9 9.4 9.8 10.0 9.9 11.2 12.1

:error ofmargin

:Interval-t

Page 33: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

33

Ex 10. Drivers along a stretch of Abercorn were randomly selected to determine average speeds. In a sample of 23 cars, the mean speed was 49 mph and the standard deviation 4.25 mph. Find a 90% CI.

:error ofmargin

Given stats, need to enter: x=49, s = 4.25, n=23, C-Level=.90

:Interval-t

Page 34: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

34

Ex 11. A new process for creating artificial sapphires is being studied. From a random sample of 37 sapphires, the mean weight is found to be 6.75 carats with a standard deviation of .33 carats. Find a 99% CI.

:error ofmargin

Given stats, need to enter: x=6.75, s = .33, n=37, C-Level=.99

:Interval-t

Page 35: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

35

Significance Tests

On calculator: STAT, TESTS, 2:T –Test

Given data, need to enter: m0, List location, Ha

Given stats, need to enter: m0, x, s, n, Ha

Select input (Data or Stats), enter appropriate info, then Calculate or Draw

Output: Test stat, p-value

Page 36: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

36

Ex 12. Do Honolulu residents have shorter lifespans than other Hawaiians? In a sample of 20 Honolulu residents, the mean lifespan was 71.4 years with a standard deviation of 15.62 years. The average Hawaiian lifespan is 77 years. Perform a significance test at the 5% level.

:

:0

aH

H

t:statTest -1 0 1 2 3-2-3

:value p

:conclusion

Page 37: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

37

Ex 13. Do drivers pay attention to the posted speed limits? In a sample of 23 cars, the mean speed was 49 mph and the standard deviation 4.25 mph. Is there evidence at the 10% significance level that drivers drive at something other than the posted speed limit of 50 mph?

:

:0

aH

H

t:statTest

-1 0 1 2 3-2-3

:value p

:conclusion

Page 38: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

38

Ex 14. In producing artificial sapphires, you want to know if a new method makes something other than the industry’s average standard of 7 carat gems. From a random sample of 37 sapphires, the mean weight is found to be 6.75 carats with a standard deviation of .33 carats. Is there evidence at the a = .01 level?

:

:0

aH

H

t:statTest

-1 0 1 2 3-2-3

:value p

:conclusion

Page 39: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

39

Compare C.I to two-tailed S.T.

stats: x=49, s = 4.25, n=23, C-Level=.90, a = .10

:Interval-t:conclusion T..S

stats: x=6.75, s = .33, n=37, C-Level=.99, a = .01

:Interval-t:conclusion T..S

Ex 10&13

Ex 11&14

Page 40: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

40

Ex 15. Do educational toys make a difference? Using 6 pairs of identical twins to lessen any outside factors, one child is given educational toys and the other child is given non-educational toys. The difference in reading level is calculated for each pair. (age for exp. – age for con.)

:

:0

aH

H

t:statTest :value p

:conclusion

2.16 ,442 x s.-

Page 41: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

41

Single Population Proportions

1. Asking about categorical variables

2. Questions like: Yes or No? Option 1, 2, or 3?

We want to make an inference for the proportion of a population that exhibit a certain characteristic.

p = population proportion that has some characteristic

p̂ sample proportion that has the characteristic

An individual in a sample is a success if it has the quality.

Page 42: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

42

Sampling distribution for samples of size n

from a population with p.

For large values of n:

Mean:

Std. Deviation:

Page 43: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

43

This is best with large sized sample and at least 15 of

each, successes and failures.

..ˆ * ESzp

Confidence Interval:

Estimate ± margin of error

n

ppES

)ˆ1(ˆ..

Enter: x = number of successes

n = sample size

Confidence level

On calculator: STAT, TESTS, A:1-PropInt…

Page 44: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

44

testedbeing proportion populationp

00 : ppH

Significance Test:

npp

ppppz

p )1(

ˆˆ:StatTest

00

0

ˆ

0

n

ppp

)1( 00ˆ

Note: output gives z = (test stat) and p = (p-value)

On calculator: STAT, TESTS, 5:1 –PropZTest need to enter: p0, x, n, Ha

Page 45: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

45

error ofmargin estimate

Ex 16. Create a 96% C.I for estimating the proportion of all escaped convicts who will be eventually recaptured.

Data Summary: 7867recaptured ,10351 n

p

:error ofmargin

:I..C

Page 46: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

46

Deciding on sample sizeIf you want a margin of error at a certain level, m,

what sample size is needed for a given confidence level?

*,:Given zm

where p* is some guess for the sample proportion.

A value of p* = .5 is the most conservative (without any info on which to base a guess).

What sample size is needed in order to estimate the proportion of people voting for the Democratic candidate if the margin of error is to be no larger than 0.03 with a 99% confidence level?

Page 47: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

47

Ex 17. Is new method of sight restoration better than an old one where only 30% of patients recover their sight? Test at the 1% significance level.

:

:0

aH

H

z:statTest

88sight recovered ,225 n

p-value

Summary:

Page 48: Inference Basics  Since about of the samples are if we create intervals based on a sample mean, x, and go up and down by, then of the time, we’ll create.

48

Ex 18. Diltiazem causes headaches in 12% of hypertension patients. Will regular exercise reduce this side effect?

Test at the 1% significance level.

:

:0

aH

H

16sufferers headache ,209 nSummary:

z:statTest

p-value