Stat 31, Section 1, Last Time

Post on 25-Jan-2016

31 views 0 download

description

Stat 31, Section 1, Last Time. T Distribution (handles unknown σ ) Computation with TDIST & TINV Confidence Intervals Hypothesis Tests. Reading In Textbook. Approximate Reading for Today’s Material: Pages 485-504, 536-549 Approximate Reading for Next Class: Pages 555-566. Midterm II. - PowerPoint PPT Presentation

Transcript of Stat 31, Section 1, Last Time

Stat 31, Section 1, Last Time• T Distribution (handles unknown σ)

– Computation with TDIST & TINV

– Confidence Intervals

– Hypothesis Tests

Reading In Textbook

Approximate Reading for Today’s Material:

Pages 485-504, 536-549

Approximate Reading for Next Class:

Pages 555-566

Midterm IIComing on Tuesday, April 10

Think about:

• Sheet of Formulas– Again single 8 ½ x 11 sheet– New, since now more formulas

• Redoing HW…

• Asking about those not understood

• Will schedule Extra Office Hours

And now for somethingcompletely different…

Professional Statisticians Dislike Excel:

Very poor handling of numerics

Unacceptable?!?

Jeff Simonoff Example:http://www.stern.nyu.edu/~jsimonof/classes/1305/pdf/excelreg.pdf

And now for somethingcompletely different…

A similar example:

Class Example 28:http://stat-or.unc.edu/webspace/postscript/marron/Teaching/stor155-2007/Stor155Eg28.xls

Problem 1: Excel doesn’t keep enough

significant digits (relative to other

software)

[single precision vs. double precision]

And now for somethingcompletely different…

Surprise for me: Problem didn’t turn up…

Potential reason:

• Different Excel versions

• I.e. Problem fixed in newest versions…

• Check: Looked at my machine

And now for somethingcompletely different…

And now for somethingcompletely different…

Quite different answers.

Check Versions:

And now for somethingcompletely different…

But organizational problems still exist…

For me those were the major problems…

Comments on Email

• Seems to be generally working well• People seem to be learning from it• But I got overwhelmed last night & this

morning• Please try to ask questions earlier…

Bad response from me: Problem 6.1

Bad Response: 6.61

Bad Response: 6.61

Bad Response: 6.61

• My apologies

• I tried to cut a corner

• Didn’t follow personal rule of writing it out

• Downside of mass communication…

• Let’s fix this now

• I will ask grader to accept everybody’s answer

Bad Response: 6.61

Problem: testing

H0: mu = 1.4

Ha: mu > 1.4

Based on Z-score of 1.75

Bad Response: 6.61

Based on Z-score of 1.75

Good news:

• ½ of work is already done

• Don’t need to mess with Xbar, n, s.d….

• Just need P-value

Bad Response: 6.61

Based on Z-score of 1.75

P-value = P{what saw or m.c. | Bdry}

= P{Z >= 1.75}

= 1 – P{Z <= 1.75}

= 1 - NORMDIST(1.75,0,1,true)

= 0.0401 (Excel)

Bad Response: 6.61P-value = 0.0401

Interpretation via “yes – no”:

Compare 0.0401 to 0.05:

Since 0.0401 < 0.05, say “have statistical

significance”

(this is answer to part (b))

Bad Response: 6.61P-value = 0.0401

Part (c): “test at level 0.01”

• I.e. compare P-value to 0.01

• Note 0.0401 > 0.01

• So do not have strong evidence

• I.e. “Accept H0”

2 Sample InferenceMain Idea:

• Previously studied single populations

• Modeled as:– Measurement Error

– Counts

• Did Inference:– Confidence Intervals

– Hypothesis Tests

nNX

,~

n

pppNppnBiX

)1(,~ˆ),,(~

2 Sample InferenceMain Idea:

• Extend to two populations

• Modeled as:– Measurement Error

– Counts

• Will Develop Inference:– Confidence Intervals

– Hypothesis Tests

1

111 ,~n

NX

2

222 ,~n

NX

),(~ 111 pnBiX ),(~ 222 pnBiX

2 Sample InferenceLocation in Text:

• Measurement Error– Sec. 7.1

– Sec. 7.2

• Counts– Sec. 8.2

1

111 ,~n

NX

2

222 ,~n

NX

),(~ 111 pnBiX ),(~ 222 pnBiX

2 Sample Measurement Error

Easy Case: Paired Differences

Have Treatment 1:

Treatment 2:

Important: Measurements Connected,

e.g. made on same objects

nXXX ,,, 21

nYYY ,,, 21

2 Sample Measurement Error

Easy Case: Paired Differences

Have Treatment 1:

Treatment 2:

Approach: Apply 1 sample methods to:

nXXX ,,, 21

nYYY ,,, 21

niYXD iii ,,1,

2 Paired SamplesE.g. Old Textbook 7.32 (now 7.39):

Researchers studying Vitamin C in a product were concerned about loss of Vitamin C during shipment and storage. They marked a collection of bags at the factory, and measured the vitamin C. 5 months later, in Haiti, they found the same bags, and again measured the Vitamin C.

2 Paired SamplesE.g. Old Textbook 7.32 (now 7.39):

The data are the two Vitamin C measurements, made for each bag.

a. Set up hypotheses to examine the question of interest.

b. Perform the significance test, and summarize the result.

c. Find 95% CIs for the factory mean, and the Haiti mean, and the mean change.

2 Paired SamplesE.g. Old Textbook 7.32 (now 7.39):

a. Sample average difference =

Some evidence factory is bigger,

is it strong evidence???

Let = Difference: Haiti – Factory

1-sided, from “idea of loss”

33.5D

D0:0 DH

0: DAH

2 Paired SamplesE.g. Old Textbook 7.32 (now 7.39):

b. 0|..33.5 DcmorDPvalueP

0|33.5 DDP

D

DD nsnsD

P |33.5

D

Dn nstP |33.5

1

2 Paired SamplesE.g. Old Textbook 7.32 (now 7.39):b.

But recall how TDIST works:

=

So compute with:

D

Dn nstPvalueP |33.5

1

DD

n nstPvalueP |33.5

1

2 Paired SamplesE.g. Old Textbook 7.32 (now 7.39):

b. Excel Computation:

Class Example 27, Part 3http://stat-or.unc.edu/webspace/postscript/marron/Teaching/stor155-2007/Stor155Eg27.xls

P-value = 1.87 x 10-5

Interpretation: very strong evidence

either yes-no or gray level

2 Paired SamplesVariations:

1. EXCEL function TTEST is useful here

Notes:

a. Type is paired (discuss others later)

b. Get same answer from swapping Array 1 and Array 2

(check these in class example)

c. This is something Excel does well

2 Paired SamplesVariations:

2. Can also use:

Tools Data Analysis T-test Paired

to give detailed results

e.g. d.f. = 26

(others we haven’t learned yet)

2 Paired SamplesE.g. Old Textbook 7.32 (now 7.39):

c. Confidence Intervals

See Class Example 27, Part 3chttp://stat-or.unc.edu/webspace/postscript/marron/Teaching/stor155-2007/Stor155Eg27.xls

Margin of error =

(same as above, but NORMINV TINV)

So CI has endpoints:

ns

nTINVm 1,05.0

mX

Paired Sampling CIs & TestsHW:

7.27, 7.31, 7.41

Interpret P-values: (i) yes-no (ii) gray-level

(suggestion: use TTEST, for hypo tests)

And now for somethingcompletely different…

Does the statement, “We've always done it like that” ring any bells?

The US standard railroad gauge (distance between the rails) is 4 feet, 8.5 inches.

That's an exceedingly odd number.

Why was that gauge used?

And now for somethingcompletely different…

Because that's the way they built them in England, and English expatriates built the US Railroads.

Why did the English build them like that?

Because the first rail lines were built by the same people who built the pre-railroad tramways, and that's the gauge they used.

And now for somethingcompletely different…

Why did "they" use that gauge then?

Because the people who built the tramways used the same jigs and tools that they used for building wagons, which used that wheel spacing.

And now for somethingcompletely different…

Okay! Why did the wagons have that particular odd wheel spacing?

Well, if they tried to use any other spacing, the wagon wheels would break on some of the old, long distance roads in England , because that's the spacing of the wheel ruts.

And now for somethingcompletely different…

So who built those old rutted roads?

Imperial Rome built the first long distance roads in Europe (and England ) for their legions. The roads have been used ever since.

And the ruts in the roads?

Roman war chariots formed the initial ruts, which everyone else had to match for fear of destroying their wagon wheels.

Since the chariots were made for Imperial Rome , they were all alike in the matter of wheel spacing.

And now for somethingcompletely different…

The United States standard railroad gauge of 4 feet, 8.5 inches is derived from the original specifications for an Imperial Roman war chariot.

And bureaucracies live forever.

So the next time you are handed a specification and wonder what horse's ass came up with it, you may be exactly right, because the Imperial Roman army chariots were made just wide enough to accommodate the back ends of two war horses!

And now for somethingcompletely different…

When you see a Space Shuttle sitting on its launch pad, there are two big booster rockets attached to the sides of the main fuel tank.

These are solid rocket boosters, or SRBs.

The SRBs are made by Thiokol at their factory at Utah.

The engineers who designed the SRBs would have preferred to make them a bit fatter, but the SRBs had to be shipped by train from the factory to the launch site.

And now for somethingcompletely different…

The railroad line from the factory happens to run through a tunnel in the mountains.

The SRBs had to fit through that tunnel. The tunnel is slightly wider than the railroad track, and the railroad track, as you now know, is about as wide as two horses' behinds.

So, a major Space Shuttle design feature of what is arguably the world's most advanced transportation system was determined over two thousand years ago by the width of a horse's ass.

And now for somethingcompletely different…

- And –

you thought being a HORSE'S ASS wasn't important!

2 Sample Measurement Error

Easy Case: Paired Differences

Have Treatment 1:

Treatment 2:

Hard case: 2 different (unmatched) samples

different!

nXXX ,,, 21

nYYY ,,, 21

XnXXX ,,, 21

YnYYY ,,, 21

2 Sample Measurement Error

Hard case: 2 different (unmatched) samples

Notes:

• There are several variations

• For Hypo. Testing, EXCEL works well

• Variations well labelled in TTEST

2 Sample Measurement Error

Hard case: 2 different (unmatched) samples

Main Ideas:

Data:

Sample Averages:

XnXXX ,,, 21

YnYYY ,,, 21

X

XX

nNX

,~

Y

YY

nNY

,~

2 Sample Measurement Error

Hard case: 2 different (unmatched) samples

Base inference on:

Probability Theory (can show):

YX

Y

Y

X

XYX nn

NYX22

,~

2 Sample Measurement Error

Hard case: 2 different (unmatched) samples

Probability Theory (can show):

Assumptions:

• Xs & Ys Independent

• Otherwise based on Law of Averages

Y

Y

X

XYX nn

NYX22

,~

2 Sample Measurement Error

Step towards statistical inference:

2 sample Z statistic

• Just do standardization (usual idea)

• Handle unknown s.d.s???

1,0~22

N

nn

YX

Y

Y

X

X

YX

2 Sample Measurement Error

For unknown s.d.s, use usual approx:

For 2 sample t statistic

Y

Y

X

X

YX

ns

ns

YX22

YYXX ss ,

2 Sample Measurement Error

2 sample t statistic:

Probability Distribution:

• 2 sample version of t distribution

• Well modelled by EXCEL using TTEST

• Use this for Hypothesis Testing

Y

Y

X

X

YX

ns

ns

YX22

2 Sample Measurement Error

2 sample t statistic:

Probability Distribution:

• 2 sample version of t distribution

• Well modelled by EXCEL using TTEST

• Use this for Hypothesis Testing

Y

Y

X

X

YX

ns

ns

YX22

2 Sample Measurement Error

Variations on TTest

2 Sample Measurement Error

Variations on TTest: Argument “Type”

1. Paired (simple case above)

2. Two sample, equal variance

(studied below)

3. Two sample, unequal variance

(version derived above)

2 Sample Measurement Error

Variations on TTest: Argument “Type”

2. Two sample, equal variance

Main Idea: when

• Can find an “improved estimate”

• By “pooling data”

• i.e. use combined

• Won’t use in this class

YX

YXs

2 Separate SamplesE.g. Old Textbook 7.32 (now 7.39):

b. Do separate sample Hypo test,

Class Example 27, Part 3http://stat-or.unc.edu/webspace/postscript/marron/Teaching/stor155-2007/Stor155Eg27.xls

P-value = 3.95 x 10-6

Interpretation: very strong evidence

either yes-no or gray level

2 Separate SamplesHW:

7.75c, 7.77c