Download Confidence Intervals with Means

Document related concepts

Degrees of freedom (statistics) wikipedia , lookup

History of statistics wikipedia , lookup

Sufficient statistic wikipedia , lookup

Taylor's law wikipedia , lookup

Bootstrapping (statistics) wikipedia , lookup

Misuse of statistics wikipedia , lookup

Resampling (statistics) wikipedia , lookup

Student's t-test wikipedia , lookup

Transcript
Confidence
Intervals with
Means
Chapter 9
Formula:
Standard
deviation of
Critical value
statistic
Confidence Interval :
  

x  z * 
 n
statistic
Margin of error
Student’s t- distribution
• Developed by William Gosset
• Continuous distribution
• Unimodal, symmetrical, bell-shaped
density curve
• Above the horizontal axis
• Area under the curve equals 1
• Based on degrees of freedom
df = n - 1
How does the t-distributions
compare to the standard
normal distribution?
• Shorter & more spread out
• More area under the tails
• As n increases, t-distributions
become more like a standard
normal distribution
Formula:
Standard
deviation of
Standard error
–
Critical value
statistic
when you
substitute s for .
Confidence Interval :
 s 

x  t * 
 n
statistic
Margin of error
How to find t*
Can also use invT on the calculator!
Need upper t* value with 5% is above – so
95% is below
invT(p,df)
Find these t*
90% confidence when n = 5
95% confidence when n = 15
t* =2.132
t* =2.145
Steps for doing a confidence
interval:
1) Assumptions –
2) Calculate the interval
3) Write a statement about the interval
in the context of the problem.
We are ________% confident that the true
mean context is between ______ and
______.
Assumptions for t-inference
• Have an SRS from population (or
randomly assigned treatments)
•  unknown
• Normal (or approx. normal) distribution
– Given
– Large sample size
– Check graph of data
Use only one of
these methods to
check normality
Ex. 2) A medical researcher measured
the pulse rate of a random sample of 20
adults and found a mean pulse rate of
72.69 beats per minute with a standard
deviation of 3.86 beats per minute.
Assume pulse rate is normally
distributed. Compute a 95% confidence
interval for the true mean pulse rates of
adults.
We are 95% confident that the
true mean pulse rate of adults is
between 70.883 & 74.497.
Ex. 3) Consumer Reports tested 14
randomly selected brands of vanilla
yogurt and found the following numbers
of calories per serving:
160 200 220 230 120 180 140
130 170 190 80 120 100 170
Compute a 98% confidence interval for
the average calorie content per serving
of vanilla yogurt.
We are 98% confident that the true mean
calorie content per serving of vanilla
yogurt is between 126.16 calories & 189.56
calories.
Ex 3 continued) A diet guide claims that
you will get 120 calories from a serving
Note: confidence intervals tell us
of vanilla yogurt. What does this
if something is NOT EQUAL –
evidence
indicate?
never less or greater than!
Since 120 calories is not contained
within the 98% confidence interval, the
evidence suggest that the average
calories per serving does not equal
120 calories.
CI & p-values deal with area in the tails
Robust
– is the area changed greatly when
there
is
skewness
• An inference procedure is ROBUST if
the confidence level or p-value doesn’t
change much if the normality
assumption is violated.
Since there is more area in the tails in tdistributions,can
then,
a distribution
has
• t-procedures
beif used
with some
some skewness,
tail area
not
skewness,
as long the
as there
areisno
greatly affected.
outliers.
• Larger n can have more skewness.
Find a sample size:
• If a certain margin of error is wanted,
then to find the sample size necessary
for that margin of error use:
  
m  z *

 n
Always round up to the nearest person!
Ex 4) The heights of SHS male
students is normally distributed with
 = 2.5 inches. How large a sample
is necessary to be accurate within +
.75 inches with a 95% confidence
interval?
n = 43
Some Cautions:
• The data MUST be a SRS from the
population (or randomly assigned
treatment)
• The formula is not correct for more
complex sampling designs, i.e.,
stratified, etc.
• No way to correct for bias in data
Cautions continued:
• Outliers can have a large effect on
confidence interval
• Must know  to do a z-interval –
which is unrealistic in practice
Hypothesis Tests
One Sample Means
Steps for doing a hypothesis
test
“Since the p-value < (>) a, I reject
1) Assumptions
(fail to reject) the H0. There is (is
not) sufficient evidence to suggest
thathypotheses
Ha (in context).”
2) Write
& define parameter
H0: m = 12 vs Ha: m (<, >, or ≠) 12
3) Calculate the test statistic & p-value
4) Write a statement in the context of the
problem.
Assumptions for t-inference
• Have an SRS from population (or
randomly assigned treatments)
•  unknown
• Normal (or approx. normal) distribution
– Given
– Large sample size
– Check graph of data
Use only one of
these methods to
check normality
Formulas:
 unknown:
statistic - parameter
test statistic 
standard deviation of statistic
t=
x m
s
n
Calculating p-values
• For z-test statistic –
– Use normalcdf(lb,ub)
– [using standard normal curve]
• For t-test statistic –
– Use tcdf(lb, ub, df)
Example 1: Bottles of a popular cola are
supposed to contain 300 mL of cola.
There is some variation from bottle to
bottle. An inspector, who suspects that
the bottler is under-filling, measures the
contents of six randomly selected bottles.
Is there sufficient evidence that the
bottler is under-filling the bottles?
Use a = .1
299.4 297.7 298.9 300.2 297 301
• I have an SRS of bottles
SRS?
Normal?
•Since the boxplot is approximately symmetrical with
no
outliers, the sampling distribution is approximatelyHow do you
know?
normally distributed
Do you
know ?
What are your
H0: m = 300 where m is the true mean amount
hypothesis
statements? Is
Ha: m < 300 of cola in bottles
there a key word?
299 .03  300
t 
 1.576 p-value =.0880
a = .1
1.503
Plug p-value
values to
Compare your
6
into decision
formula.
a & make
Since p-value < a, I reject the null hypothesis.
Writethat
conclusion
in
There is sufficient evidence to suggest
the true
context
in terms of Ha.
mean cola in the bottles is less than
300 mL.
•  is unknown
Example 3: The Wall Street Journal
(January 27, 1994) reported that based
on sales in a chain of Midwestern grocery
stores, President’s Choice Chocolate Chip
Cookies were selling at a mean rate of
$1323 per week. Suppose a random sample
of 30 weeks in 1995 in the same stores
showed that the cookies were selling at
the average rate of $1208 with standard
deviation of $275. Does this indicate that
the sales of the cookies is lower than the
earlier figure?
Assume:
•Have an SRS of weeks
•Distribution of sales is approximately normal due to
large sample size
•  unknown
H0: m = 1323
where m is the true mean cookie sales
error in context?
Ha: m < 1323What is the
per potential
week
What is a consequence of that error?
1208  1323
t 
 2.29 p value  .0147
275
30
Since p-value < a of 0.05, I reject the null hypothesis.
There is sufficient evidence to suggest that the sales of
cookies are lower than the earlier figure.
Example 9: President’s Choice Chocolate Chip
Cookies were selling at a mean rate of $1323
per week. Suppose a random sample of 30
weeks in 1995 in the same stores showed
that the cookies were selling at the average
rate of $1208 with standard deviation of
$275. Compute a 90% confidence interval for
the mean weekly sales rate.
CI = ($1122.70, $1293.30)
Based on this interval, is the mean weekly
sales rate statistically less than the
reported $1323?
Matched Pairs
Test
A special type of
t-inference
Matched Pairs – two forms
• Pair individuals by
certain
characteristics
• Randomly select
treatment for
individual A
• Individual B is
assigned to other
treatment
• Assignment of B is
dependent on
assignment of A
• Individual persons
or items receive
both treatments
• Order of
treatments are
randomly assigned
or before & after
measurements are
taken
• The two measures
are dependent on
the individual
Is this an example of matched pairs?
1)A college wants to see if there’s a
difference in time it took last year’s
class to find a job after graduation and
the time it took the class from five years ago
to find work after graduation. Researchers
take a random sample from both classes and
measure the number of days between
graduation and first day of employment
No, there is no pairing of individuals, you
have two independent samples
Is this an example of matched pairs?
2) In a taste test, a researcher asks people
in a random sample to taste a certain brand
of spring water and rate it. Another
random sample of people is asked to
taste a different brand of water and rate it.
The researcher wants to compare these
samples
No, there is no pairing of individuals, you
have two independent samples – If you would
have the same people taste both brands in
random order, then it would be an example
of matched pairs.
Is this an example of matched pairs?
3) A pharmaceutical company wants to test
its new weight-loss drug. Before giving the
drug to a random sample, company
researchers take a weight measurement
on each person. After a month of using
the drug, each person’s weight is
measured again.
Yes, you have two measurements that are
dependent on each individual.
A whale-watching company noticed that many
customers wanted to know whether it was
better to book an excursion in the morning or
the afternoon.
To test
this question, the
You may subtract
either
company
thewhen
following data on 15
way – collected
just be careful
writing Hadays over the past
randomly selected
month. (Note: days were not
consecutive.)
Day
1
2
Morning
8 9
3
4
5
6
7
8
9
10
11 12 13 14 15
7 9 10 13 10
8
2
5
7 7 6 8 7
After8 10 9 8 9 11 8
noon
Since you have two values for
10
4 7 8 9 6 6 9
First, you must find
the differences for
each day.
each day, they are dependent
on the day – making this data
matched pairs
Day
1
2
3
4
5
6
7
Morning
8
9
7 9 10 13 10
Afternoon
8 10 9 8 9 11
8
9
10 11
8
2
5
1
2
1
3
1
4
1
5
7 7 6 8 7
8 10 4 7 8 9 6 6 9
I subtracted:
Differen
Morning – afternoon - 0
-1
-2
1
1
2
2
-2
-2
-2
0
2
ces
1 2
2
You could subtract the other
Assumptions:
way!
• Have an SRS of days for whale-watching
You need to state assumptions using the
•  unknown
differences!
•Since the normal probability plot is approximately
linear, the distribution of difference is approximately
Notice the granularity in this
normal.
plot, it is still displays a nice
linear relationship!
Differences
0
-1
-2
1
1
2
2
-2
-2
-2
-1 -2
0
2
Is there sufficient evidence that more whales are
sighted in the afternoon?
H0: mD = 0
Ha: mD < 0
Be careful writing your Ha!
Think about
how you–
If you subtract
afternoon
subtracted: M-A
Hdifferences
mD>0should
Notice morning;
we
mthen
a:more
D foris
Ifused
afternoon
& it equals
since the nullbeshould
the0 differences
+ or -?
be that there
NOat
difference.
Don’t islook
numbers!!!!
Where mD is the true mean
difference in whale sightings
from morning minus afternoon
-2
Differences
0
-1
-2
1
1
2
2
-2
finishing the hypothesis test:
x m
.4  0
t 

 .945
s
1.639
n
15
p  .1803
df  14
a  .05
-2
-2
-1 -2
0
2
In your calculator,
perform
t-test
Notice athat
if
the
youusing
subtracted
differences
(L3)
A-M, then your
test statistic
t = + .945, but pvalue would be
the same
Since p-value > a, I fail to reject H0. There
is
How could
I
insufficient evidence to suggest that more
whales
increase
theare
sighted in the afternoon than in the morning.
power of this
test?
-2
Two-Sample
Inference
Procedures with
Means
Remember:
m  m m
x y

x y
x
y
  
2
2
x
y
We will
be
intereste
d in the
differen
ce of
means,
so we
will use
this to
find
standard
error.
Suppose we have a population of
adult men with a mean height of
71 inches and standard deviation
of 2.6 inches. We also have a population of
adult women with a mean height of 65 inches
and standard deviation of 2.3 inches. Assume
heights are normally distributed.
Describe the distribution of the difference in
heights between males and females (malefemale).
Normal distribution with
mx-y =6 inches & x-y =3.471 inches
Female
65
Male
71
Difference = male - female
6
 = 3.471
a) What is the probability that the
height of a randomly selected man is
at most 5 inches taller than the
height of a randomly selected
woman?
P((xM-xF) < 5) = normalcdf(-∞,5,6,3.471) = .3866
b) What is the 70th percentile for the
difference (male-female) in heights
of a randomly selected man &
woman?
(xM-xF) = invNorm(.7,6,3.471) = 7.82
•
Two-Sample Procedures
with means When we
compare,
The goal of these inferencewhat are we
procedures is to compare theinterested
in?
responses to two treatments or to
compare the characteristics of two
populations.
• We have INDEPENDENT samples
from each treatment or population
Assumptions:
• Have two SRS’s from the
populations or two randomly
assigned treatment groups
• Samples are independent
• Both distributions are
approximately normally
– Have large sample sizes
– Graph BOTH sets of data
• ’s unknown
Formulas
Since in real-life, we
will NOT know both ’s,
we will do t-procedures.
Degrees of Freedom
Option 1: use the smaller of the two
values n1 – 1 and n2 – 1
This will produce conservative
results – higher p-values & lower
confidence.
Calculator
Option 2: approximation used bydoes this
automatically!
technology
s s 
2
2
1
2
1
2
2
  
n n 

df 
1 s 
1 s
  

n  1 n  n  1 n
1
2
2
1
2
1
2
2



Confidence
Called
intervals:
standard
error
CI  statistic  critical value SD of statistic
s
s
x  x   t *

n n
1
2
2
1
2
1
2
2

Pooled procedures:
• Used for two populations with the
same variance
• When you pool, you average the twosample variances to estimate the
common population variance.
• DO NOT use on AP Exam!!!!!
We do NOT know the variances of the population,
so ALWAYS tell the calculator NO for pooling!
Two competing headache remedies claim to give fastacting relief. An experiment was performed to
compare the mean lengths of time required for bodily
absorption of brand A and brand B. Assume the
absorption time is normally distributed. Twelve people
were randomly selected and given an oral dosage of
brand A. Another 12 were randomly selected and given
an equal dosage of brand B. The length of time in
minutes for the drugs to reach a specified level in the
blood was recorded. The results follow:
mean
SD
n
Brand A
20.1
8.7
12
Brand B
18.9
7.5
12
Describe the shape & standard error for sampling
distribution of the differences in the mean speed of
absorption. (answer on next screen)
Describe the sampling distribution of the
differences in the mean speed of absorption.
Normal distribution with S.E. = 3.316
Find a 95% confidence interval difference in
mean lengths of time required for bodily
absorption of each brand. (answer on next screen)
Assumptions:
State assumptions!
Thinkrandomly
“Price assigned
is Right”!
Have 2 independent
treatments
Given the absorption rate is normally distributed
’s unknown Closest without going
over
& calculations
s12 s22 Formula
x1  x2   t *


df  21.53
n1 n2
2
2
8.7 7.5
20.1  18.9  2.080

 (5.685,8.085)
12
12
From calculator df =
Conclusion in context
We are 95% confident that the true difference in mean
21.53, use t* for df =
lengths of time required for bodily absorption of each
21 & 95% confidence
brand is between –5.685 minutes and 8.085 minutes.
level
Note: confidence interval
statements
• Matched pairs – refer to “mean
difference”
• Two-Sample – refer to
“difference of means”
Hypothesis Statements:
H0: m1 - m2 = 0
H0: m1 = m2
Ha: m1 - m2 < 0
Ha: m1< m2
Ha: m1 - m2 > 0
Ha: m1> m2
Ha: m1 - m2 ≠ 0
Ha: m1 ≠ m2
Be sure
to define
BOTH m1
and m2!
Hypothesis Test:
Test statistic 
Since we usually
assume H0 is true,
statistic
parameter
then this equals 0 –
can usually
SDsoofwestatistic
leave it out
 x  x   m  m 
t
1
2
1
2
2
1
2
1
2
s s

n n
2
The length of time in minutes for the drugs
to reach a specified level in the blood was
recorded. The results follow:
Brand A
Brand B
mean
20.1
18.9
SD
8.7
7.5
n
12
12
Is there sufficient evidence that these
drugs differ in the speed at which they
enter the blood stream?
Have 2 independent randomly assigned treatments
State assumptions!
Given the absorption rate is normally
distributed
’s unknown
H0: mA= mB
Hypotheses & define variables!
Where mA is the true mean absorption time
for Brand A & mB is the true mean
absorption time for Brand B
Ha:mA= mB
x1  x2
20.1  18.9
t

 .361& calculations
Formula
s12 s22
8.7 2 7.52


n1 n2
12
12
Conclusion in context
p  value  .7210 df  21.53 α  .05
Since p-value > a, I fail to reject H0. There is not
sufficient evidence to suggest that these drugs differ in
the speed at which they enter the blood stream.
Suppose that the sample mean of Brand
B is 16.5, then is Brand B faster?
t
x1  x2
s12 s22

n1 n2

20.1  16.5
8.7 2 7.52

12
12
 1.085
p  value  .2896 df  21.53 α  .05
No, I would still fail to reject the null
hypothesis.
Robustness:
• Two-sample procedures are more
robust than one-sample procedures
• BEST to have equal sample sizes! (but
not necessary)