Section 12-1

Download Report

Transcript Section 12-1

Lesson 12 - 1
Inference for Regression
Objectives
 CHECK conditions for performing inference about
the slope β of the population regression line
 CONSTRUCT and INTERPRET a confidence interval
for the slope β of the population regression line
 PERFORM a significance test about the slope β of a
population regression line
 INTERPRET computer output from a least-squares
regression analysis
Vocabulary
• Statistical Inference – tests to see if the relationship is
statistically significant
Introduction
• When a scatterplot shows a linear relationship
between a quantitative explanatory variable x and a
quantitative response variable y, we can use the leastsquares line fitted to the data to predict y for a given
value of x. If the data are a random sample from a
larger population, we need statistical inference to
answer questions like these:
• Is there really a linear relationship between x and y in the
population, or could the pattern we see in the scatterplot
plausibly happen just by chance?
• In the population, how much will the predicted value of y
change for each increase of 1 unit in x? What’s the margin of
error for this estimate?
Inference for Linear Regression
• In Chapter 3, we examined data on eruptions of the
Old Faithful geyser. Below is a scatterplot of the
duration and interval of time until the next eruption
for all 222 recorded eruptions in a single month. The
least-squares regression line for this population of
data has been added to the graph.
• It has slope 10.36 and yintercept 33.97. We call
this the population
regression line (or true
regression line) because
it uses all the
observations that month
Sampling Distribution of b
• The figures below show the results of taking three
different SRSs of 20 Old Faithful eruptions in this
month. Each graph displays the selected points and
the LSRL for that sample.
Notice that the slopes of the sample regression lines – 10.2, 7.7, and
9.5 – vary quite a bit from the slope of the population regression line,
10.36.
The pattern of variation in the slope b is described by its sampling
distribution.
Sampling Distribution of b
• Confidence intervals and significance tests about
the slope of the population regression line are based
on the sampling distribution of b, the slope of the
sample regression line.
Fathom software was used to
simulate choosing 1000 SRSs of n =
20 from the Old Faithful data, each
time calculating the equation of the
LSRL for the sample. The values of
the slope b for the 1000 sample
regression lines are plotted.
Describe this approximate sampling
distribution of b.
Sampling Distribution of b
• Shape
We can see that the distribution of b-values
is roughly symmetric and unimodal. A
Normal probability plot of these sample
regression line slopes suggests that the
approximate sampling distribution of b is
close to Normal.
• Center
The mean of the 1000 b-values is 10.32.
This value is quite close to the slope of the
population (true) regression line, 10.36.
• Spread
The standard deviation of the 1000 bvalues is 1.31. Later, we will see that the
standard deviation of the sampling
distribution of b is actually 1.30.
Sampling Distribution Concepts
• The figure below shows the regression model when
the conditions are met. The line in the figure is the
population regression line µy= α + βx.
For each possible value
of the explanatory
variable x, the mean of
the responses µ(y | x)
moves along this line.
The Normal curves show
how y will vary when x is
held fixed at different values.
All the curves have the same
standard deviation σ, so the
variability of y is the same for
all values of x.
The value of σ determines
whether the points fall close
to the population regression
line (small σ) or are widely
scattered (large σ).
Conditions for Regression Inference
• The slope b and intercept a of the leastsquares line are statistics. That is, we
calculate them from the sample data. These
statistics would take somewhat different
values if we repeated the data production
process. To do inference, think of a and b as
estimates of unknown parameters α and β
that describe the population of interest.
Conditions for Regression Inference
• Repeated responses y are independent of each other
• The mean response, μy, has a straight-line
relationship with x:
μy = α + βx
where the slope β and intercept α are unknown parameters
• The standard deviation of y (call it σ) is the same for
all values of x. The value of σ is unknown.
• For any fixed value of x, the response variable y
varies according to a Normal distribution
Conditions for Regression Inference
Suppose we have n observations on an explanatory variable x and a
response variable y. Our goal is to study or predict the behavior of y for
given values of x.
• Linear The (true) relationship between x and y is linear. For any
fixed value of x, the mean response µy falls on the population (true)
regression line µy= α + βx. The slope b and intercept a are usually
unknown parameters.
• Independent Individual observations are independent of each other.
• Normal For any fixed value of x, the response y varies according to
a Normal distribution.
• Equal variance The standard deviation of y (call it σ) is the same for
all values of x. The common standard deviation σ is usually an
unknown parameter.
• Random The data come from a well-designed random sample or
randomized experiment.
• Note the acronym: LINER or Line Regression
Checking Regression Conditions
•
You should always check the conditions before doing inference about the
regression model. Although the conditions for regression inference are a bit
complicated, it is not hard to check for major violations.
•
Start by making a histogram or Normal probability plot of the residuals and
also a residual plot. Here’s a summary of how to check the conditions one
by one.
L
• Linear Examine the scatterplot to check that the overall pattern is roughly linear. Look
for curved patterns in the residual plot. Check to see that the residuals center on the
“residual = 0” line at each x-value in the residual plot.
I
• Independent Look at how the data were produced. Random sampling and random
assignment help ensure the independence of individual observations. If sampling is
done without replacement, remember to check that the population is at least 10 times
as large as the sample (10% condition).
N
• Normal Make a stemplot, histogram, or Normal probability plot of the residuals and
check for clear skewness or other major departures from Normality.
E
• Equal variance Look at the scatter of the residuals above and below the “residual =
0” line in the residual plot. The amount of scatter should be roughly the same from the
smallest to the largest x-value.
R
• Random See if the data were produced by random sampling or a randomized
experiment.
Example: Helicopter Experiment
Mrs. Barrett’s class did a variation of the helicopter
experiment on page 738. Students randomly assigned 14
helicopters to each of five drop heights: 152 centimeters
(cm), 203 cm, 254 cm, 307 cm, and 442 cm. Teams of
students released the 70 helicopters in a predetermined
random order and measured the flight times in seconds.
Example: Helicopter Experiment
The class used Minitab to carry out a least-squares
regression analysis for these data. A scatterplot, residual
plot, histogram, and Normal probability plot of the
residuals are shown below.
Conditions Check
 Linear The scatterplot shows a
clear linear form. For each drop
height used in the experiment, the
residuals are centered on the
horizontal line at 0. The residual plot
shows a random scatter about the
horizontal line.
 Normal The histogram of the
residuals is single-peaked, unimodal,
and somewhat bell-shaped. In
addition, the Normal probability plot is
very close to linear.
 Independent Because the
helicopters were released in a random
 Equal variance The residual plot
order and no helicopter was used
shows a similar amount of scatter
twice, knowing the result of one
about the residual = 0 line for the 152, observation should give no additional
203, 254, and 442 cm drop heights.
information about another observation.
Flight times (and the corresponding
residuals) seem to vary more for the
helicopters that were dropped from a  Random The helicopters were
randomly assigned to the five possible
height of 307 cm.
drop heights.
Except for a slight concern about the equal-variance condition, we should
be safe performing inference about the regression model in this setting.
Estimating the Parameters
• When the conditions are met, we can do inference
about the regression model µy = α+ βx. The first step is
to estimate the unknown parameters.
 If we calculate the least-squares regression line, the
slope b is an unbiased estimator of the population
slope β, and the y-intercept a is an unbiased
estimator of the population y-intercept α.
 The remaining parameter is the standard deviation
σ, which describes the variability of the response y
about the population regression line.
Estimating the Parameters
• We need to estimate parameters for μy = α + βx and σ
• From the least square regression line: y-hat = a + bx
we get unbiased estimators a (for α) and b (for β)
• We use n – 2 because we used a and b as estimators
Example: Helicopter Experiment
• Computer output from the least-squares regression analysis on
the helicopter data for Mrs. Barrett’s class is shown below.
Theneed
slopethe
β of
the truearegression
says the
howline
much
average
flight but it
We
intercept
= -0.03761line
to draw
andthe
make
predictions,
time
of statistical
the paperfor
helicopters
increases
when
drop
height
increases
by less
has
no
meaning
in this
example.
No
helicopter
was
dropped
from
Our
estimate
the standard
deviation
σ ofthe
flight
times
about
the true
1 centimeter.
than
150 cm, so
weathave
data near
= 0. seconds.
regression
line
eachno
x-value
is s =x 0.168
Because
= 0.0057244
the αunknown
β, ifwe
that,
We
might
actual
of the
true
regression
to on
be 0 because
This
is bexpect
also
thethe
size
ofestimates
a y-intercept
typical prediction
error
weestimate
use theline
least-squares
flightno
time
about
0.0057244
seconds
forits
each
itaverage,
should
take
time
for a helicopter
to
fallofnoa distance.
regression
line
toincreases
predict
thebyflight
time
helicopter
from
drop height.
additional
centimeter
of drop height.
The
y-intercept
of the sample
regression line is -0.03761, which is pretty close to 0.
Confidence Interval on β
• Remember our form: Point Estimate ± Margin of Error
• Since β is the true slope, then b is the point estimate
• The Margin of Error takes the form of t*  SEb
Confidence Intervals in Practice
• We use rarely have to calculate this by hand
• Output from Minitab:
Parameters: b (1.4929), a (91.3), s (17.50)
CI = PE ± MOE = 1.4929 ± (2.042)(0.4870)
= 1.4929 ± 0.9944
[0.4985, 2.4873]
t* = 2.042 from n – 2, 95% CL
Since 0 is not in the interval, then
we might conclude that β ≠ 0
Example: Helicopter Experiment
• Earlier, we used Minitab to perform a least-squares regression
analysis on the helicopter data for Mrs. Barrett’s class. Recall that
the data came from dropping 70 paper helicopters from various
heights and measuring the flight times. We checked conditions for
performing inference earlier. Construct and interpret a 95%
confidence interval for the slope of the population regression line.
SEb = 0.0002018, from the “SE Coef ” column in the computer output.
Because
the conditions
are met,
we canfrom
calculate
a t interval
for the slope
β based
We are 95%
confident that
the interval
0.0053208
to 0.0061280
seconds
on
t distribution
withslope
df = nof- the
2 = true
70 - regression
2 = 68. Using
morethe
conservative
= 60
pera cm
captures the
linethe
relating
flight time df
y and
from
t* = 2.000.
dropTable
heightBxgives
of paper
helicopters.
The 95% confidence interval is
b ± t* SEb
= 0.0057244 ± 2.000(0.0002018)
= 0.0057244 ± 0.0004036
= (0.0053208, 0.0061280)
Inference Tests on β
• Since the null hypothesis can not be proved, our
hypotheses for tests on the regression slope will be:
H0: β = 0
Ha: β ≠ 0
(no correlation between x and y)
(some linear correlation)
• Testing correlation makes sense only if the
observations are a random sample.
– This is often not the case in regression settings, where
researchers often fix in advance the values of x being tested
Test Statistic
Example: Crying and IQ
• Infants who cry easily may be more easily stimulated than others.
This may be a sign of higher IQ. Child development researchers
explored the relationship between the crying of infants 4 to 10 days
old and their later IQ test scores. A snap of a rubber band on the
sole of the foot caused the infants to cry. The researchers recorded
the crying and measured its intensity by the number of peaks in the
most active 20 seconds. They later measured the children’s IQ at
age three years using the Stanford-Binet IQ test. A scatterplot and
Minitab output for the data from a random sample of 38 infants is
below.
Do these data provide convincing evidence
that there is a positive linear relationship
between crying counts and IQ in the
population of infants?
Example: Crying and IQ Test
• We want to perform a test of
• H0 : β = 0
• Ha : β > 0
where β is the true slope of the population regression line
relating crying count to IQ score. No significance level
was given, so we’ll use α = 0.05.
Example: Crying and IQ Conditions
• Plan: If the conditions are met, we will perform a t test for the
slope β.
• • Linear : The scatterplot suggests a moderately weak positive
linear relationship between crying peaks and IQ. The residual plot
shows a random scatter of points about the residual = 0 line.
• • Independent: Later IQ scores of individual infants should be
independent. Due to sampling without replacement, there have to
be at least 10(38) = 380 infants in the population from which these
children were selected.
Example: Crying and IQ Conditions
• Plan: If the conditions are met, we will perform a t test for the
slope β.
• • Normal: The Normal probability plot of the residuals shows a
slight curvature, which suggests that the responses may not be
Normally distributed about the line at each x-value. With such a
large sample size (n = 38), however, the t procedures are robust
against departures from Normality.
• • Equal variance: The residual plot shows a fairly equal amount of
scatter around the horizontal line at 0 for all x-values.
• • Random: We are told that these 38 infants were randomly
selected.
Example: Crying and IQ t-Test
• With no obvious violations of the conditions, we
proceed to inference. The test statistic and P-value
can be found in the Minitab output.
The Minitab output gives P = 0.004 as
the P-value for a two-sided test. The Pvalue for the one-sided test is half of
this, P = 0.002.
Conclude: The P-value, 0.002, is less than our α = 0.05 significance level, so
we have enough evidence to reject H0 and conclude that there is a positive
linear relationship between intensity of crying and IQ score in the population
of infants.
TI Output from Cry-count
y = a + bx
β ≠ 0 and ρ ≠ 0
t = 3.06548
p = .004105
df = 36
a = 91.26829
b = 1.492896
s = 17.49872
r2 = .206999
r = .4549725
Minitab Output
Example: Fidgeting
• In Chapter 3, we examined data from a study that investigated why
some people don’t gain weight even when they overeat. Perhaps
fidgeting and other “nonexercise activity” (NEA) explains why.
Researchers deliberately overfed a random sample of 16 healthy
young adults for 8 weeks. They measured fat gain (in kilograms)
and change in energy use (in calories) from activity other than
deliberate exercise for each subject. Here are the data:
Example: Fidgeting Conditions
• Construct and interpret a 90% confidence interval for the slope of
the population regression line
Plan: If the conditions are met, we will use a t interval for the slope to estimate β.
• Linear The scatterplot shows a clear linear pattern. Also, the residual plot shows
a random scatter of points about the “residual = 0” line.
• Independent Individual observations of fat gain should be independent if the
study is carried out properly. Because researchers sampled without replacement,
there have to be at least 10(16) = 160 healthy young adults in the population of
interest.
• Normal The histogram of the residuals is roughly symmetric and single-peaked,
so there are no obvious departures from normality.
• Equal variance It is hard to tell from so few points whether the scatter of points
around the residual = 0 line is about the same at all x-values.
• Random The subjects in this study were randomly selected to participate.
Example: Fidgeting Finished
• Construct and interpret a 90% confidence interval for the slope of
the population regression line
Do: We use the t distribution with 16 - 2 = 14 degrees of freedom to find
the critical value. For a 90% confidence level, the critical value is t* =
1.761. So the 90% confidence interval for β is
b ± t* SEb
= −0.0034415 ± 1.761(0.0007414)
= −0.0034415 ± 0.0013056
= (−0.004747,−0.002136)
Conclude: We are 90% confident
that the interval from -0.004747
to -0.002136 kg captures the
actual slope of the population
regression line relating NEA
change to fat gain for healthy
young adults.
Beer vs BAC Example
16 student volunteers at Ohio State drank a randomly
assigned number of cans of beer. Thirty minutes later, a
police officer measured their BAC. Here are the data:
Student
1
2
3
4
5
6
7
8
Beers
5
2
9
8
3
7
3
5
BAC
0.10
0.03
0.19
0.12
0.04
0.095
0.07
0.06
Student
9
10
11
12
13
14
15
16
Beers
3
5
4
6
5
7
1
4
BAC
0.02
0.05
0.07
0.10
0.085
0.09
0.01
0.05
Enter the data into your calculator.
a) Draw a scatter plot of the data and the regression line
b) Conduct an inference test on the effect of beers on BAC
LinReg(a + bx) L1, L2, Y1
Scatter plot and Regression Line
D
F
S
O
C
• Interpret the scatter plot
Using the TI for Inference Test on β
•
•
•
•
•
•
•
Enter explanatory data into L1
Enter response data into L2
Stat  Tests  E:LinRegTTest
Xlist: L1
Ylist: L2
(Test type) β & ρ: ≠ 0 <0
>0
RegEq: (leave blank)
• Test will take two screens to output the data
Inference: t-statistic, degrees of freedom and p-value
Regression: a, b, s, r², and r
Output from Minitab
• Could we have used this instead of output from our
calculator?
Interpreting Computer Output
In the following examples of computer output
from commonly used statistical packages:
• Find the a and b values for the regression eqn
• Find r and r2
• Find SEb, t-value and p-value (if available)
We can use these outputs to finish an inference
test on the association of our explanatory and
response variables.
Sample from Excel prob 15.10
Sample from CrunchIt prob 15.20
Summary and Homework
• Summary
– Inference Conditions Needed:
1) Observations independent
2) True relationship is linear
3) σ is constant
4) Responses Normally distributed about the line
– Confidence Intervals on β can be done
– Inference testing on β use the t statistic = b/SEb
• Homework
– Day 1: 1, 3; Day 2: 5, 7, 9, 11; Day 3: 13, 15, 17, 19