Documente Academic
Documente Profesional
Documente Cultură
FALL 2008
Chapter 12
Simple Regression
1
Correlation Analysis
Correlation analysis is used to measure
strength of the association (linear relationship)
between two variables
Correlation is only concerned with strength of the
relationship
No causal effect is implied with correlation
Correlation was first presented in Chapter 3
2
Correlation Analysis
The population correlation coefficient is
denoted ρ (the Greek letter rho)
The sample correlation coefficient is
s xy
r
sxsy
where
s xy
(x x)(y
i i y)
n 1
3
Introduction to
Regression Analysis
Regression analysis is used to:
Predict the value of a dependent variable based on
the value of at least one independent variable
Explain the impact of changes in an independent
variable on the dependent variable
Dependent variable: the variable we wish to explain
(also called the endogenous variable)
Independent variable: the variable used to explain
the dependent variable
(also called the exogenous variable)
4
Linear Regression Model
Yi β0 β1xi εi
5
Simple Linear Regression
Model
The population regression model:
Population Random
Population Independent Error
Slope
Y intercept Variable term
Coefficient
Dependent
Variable
Yi β0 β1Xi ε i
Linear component Random Error
component
6
Simple Linear Regression
Model
(continued)
Y Yi β0 β1Xi ε i
Observed Value
of Y for Xi
εi Slope = β1
Predicted Value Random Error
of Y for Xi
for this Xi value
Intercept = β0
Xi X
7
Simple Linear Regression
Equation
The simple linear regression equation provides an
estimate of the population regression line
Estimated Estimate of Estimate of the
(or predicted) the regression regression slope
y value for intercept
observation i
Value of x for
yˆ i b0 b1xi observation i
8
Least Squares Estimators
min (y i yˆ i )2
min [y i (b 0 b1x i )] 2
(x x)(y
i i y)
sY
b1 i1
n
rxy
i
sX
2 x
(x x)
i1
b0 y b1x
11
Linear Regression Model
Assumptions
The random error terms, εi, are not correlated with one
another, so that
E[ε iε j ] 0 for all i j
12
Interpretation of the
Slope and the Intercept
13
Simple Linear Regression
Example
14
Sample Data for House Price
Model
House Price in $1000s Square Feet
(Y) (X)
245 1400
312 1600
279 1700
308 1875
199 1100
219 1550
405 2350
324 2450
319 1425
255 1700
15
Graphical Presentation
350
300
250
200
150
100
50
0
0 500 1000 1500 2000 2500 3000
Square Feet
16
Regression Using Excel
Tools / Data Analysis / Regression
17
Excel Output
Regression Statistics
Multiple R 0.76211 The regression equation is:
R Square 0.58082
Adjusted R Square 0.52842 house price 98.24833 0.10977 (square feet)
Standard Error 41.33032
Observations 10
ANOVA
df SS MS F Significance F
Regression 1 18934.9348 18934.9348 11.0848 0.01039
Residual 8 13665.5652 1708.1957
Total 9 32600.5000
18
Graphical Presentation
350 Slope
300
250
= 0.10977
200
150
100
50
Intercept 0
= 98.248 0 500 1000 1500 2000 2500 3000
Square Feet
19
Interpretation of the
Intercept, b0
20
Interpretation of the
Slope Coefficient, b1
21
Measures of Variation
23
Measures of Variation
(continued)
Y
yi
2
SSE = (yi - yi ) y
_
SST = (yi - y)2
y _2
_ SSR = (yi - y) _
y y
xi X
24
Coefficient of Determination, R2
The coefficient of determination is the portion
of the total variation in the dependent variable
that is explained by variation in the
independent variable
The coefficient of determination is also called
R-squared and is denoted as R2
SSR regression sum of squares
R
2
SST total sum of squares
note: 0 R 1
2
25
Examples of Approximate
r2 Values
Y
r2 = 1
X
r2 =1
26
Examples of Approximate
r2 Values
Y
0 < r2 < 1
X
27
Examples of Approximate
r2 Values
r2 = 0
Y
No linear relationship
between X and Y:
28
Excel Output
SSR 18934.9348
Regression Statistics
R 2
0.58082
Multiple R 0.76211 SST 32600.5000
R Square 0.58082
Adjusted R Square 0.52842 58.08% of the variation in
Standard Error 41.33032 house prices is explained by
Observations 10
variation in square feet
ANOVA
df SS MS F Significance F
Regression 1 18934.9348 18934.9348 11.0848 0.01039
Residual 8 13665.5652 1708.1957
Total 9 32600.5000
29
Correlation and R2
R r
2 2
xy
30
Estimation of Model
Error Variance
i
e 2
SSE
σˆ s
2 2
i1
n2 n2
e
31
Excel Output
Regression Statistics
Multiple R 0.76211 se 41.33032
R Square 0.58082
Adjusted R Square 0.52842
Standard Error 41.33032
Observations 10
ANOVA
df SS MS F Significance F
Regression 1 18934.9348 18934.9348 11.0848 0.01039
Residual 8 13665.5652 1708.1957
Total 9 32600.5000
32
Comparing Standard Errors
se is a measure of the variation of observed y
values from the regression line
Y Y
small se X large se X
2 2
s s
s b1
2 e
e
(x i x) (n 1)s x
2 2
where:
s b1 = Estimate of the standard error of the least squares slope
SSE
se = Standard error of the estimate
n2
34
Excel Output
Regression Statistics
Multiple R 0.76211
R Square 0.58082
Adjusted R Square 0.52842
Standard Error
Observations
41.33032
10
sb1 0.03297
ANOVA
df SS MS F Significance F
Regression 1 18934.9348 18934.9348 11.0848 0.01039
Residual 8 13665.5652 1708.1957
Total 9 32600.5000
35
Comparing Standard Errors of
the Slope
Sb1 is a measure of the variation in the slope of regression
lines from different possible samples
Y Y
36
Inference about the Slope:
t Test
t test for a population slope
Is there a linear relationship between X and Y?
Null and alternative hypotheses
H0: β1 = 0 (no linear relationship)
H1: β1 0 (linear relationship does exist)
Test statistic
b1 β1
where:
t b1 = regression slope
coefficient
sb1 β1 = hypothesized slope
sb1 = standard
d.f. n 2 error of the slope
37
Inference about the Slope:
t Test
(continued)
38
Inferences about the Slope:
t Test Example
b1 s b1
H0: β1 = 0 From Excel output:
H1: β1 0 Coefficients Standard Error t Stat P-value
Intercept 98.24833 58.03348 1.69296 0.12892
Square Feet 0.10977 0.03297 3.32938 0.01039
b1 β1 0.10977 0
t t 3.32938
sb1 0.03297
39
Inferences about the Slope:
t Test Example
(continued)
Test Statistic: t = 3.329
b1 s b1 t
H0: β1 = 0 From Excel output:
H1: β1 0 Coefficients Standard Error t Stat P-value
Intercept 98.24833 58.03348 1.69296 0.12892
d.f. = 10-2 = 8 Square Feet 0.10977 0.03297 3.32938 0.01039
t8,.025 = 2.3060
Decision:
a/2=.025 a/2=.025 Reject H0
Conclusion:
Reject H0 Do not reject H0 Reject H0
There is sufficient evidence
-tn-2,α/2 0 tn-2,α/2 that square footage affects
-2.3060 2.3060 3.329 house price
40
Inferences about the Slope:
t Test Example
(continued)
P-value = 0.01039
P-value
H0: β1 = 0 From Excel output:
H1: β1 0 Coefficients Standard Error t Stat P-value
Intercept 98.24833 58.03348 1.69296 0.12892
Square Feet 0.10977 0.03297 3.32938 0.01039
42
Confidence Interval Estimate
for the Slope
(continued)
43
F-Test for Significance
44
Excel Output
Regression Statistics
Multiple R 0.76211
MSR 18934.9348
R Square 0.58082 F 11.0848
Adjusted R Square 0.52842 MSE 1708.1957
Standard Error 41.33032
Observations 10 With 1 and 8 degrees P-value for
of freedom the F-Test
ANOVA
df SS MS F Significance F
Regression 1 18934.9348 18934.9348 11.0848 0.01039
Residual 8 13665.5652 1708.1957
Total 9 32600.5000
45
F-Test for Significance
(continued)
47
Predictions Using
Regression Analysis
Predict the price for a house
with 2000 square feet:
98.25 0.1098(200 0)
317.85
The predicted price for a house with 2000
square feet is 317.85($1,000s) = $317,850
48
Relevant Data Range
When using a regression model for prediction,
only predict within the relevant range of data
450
400
House Price ($1000s)
350
300
250
200
150 Risky to try to
100
extrapolate far
50
0
beyond the range
0 500 1000 1500 2000 2500 3000 of observed X’s
Square Feet
49
Estimating Mean Values and
Predicting Individual Values
Goal: Form intervals around y to express
uncertainty about the value of y for a given xi
Confidence
Interval for
the expected
Y
y
value of y,
given xi
y = b0+b1xi
Prediction Interval
for an single
observed y, given xi
xi X
50
Confidence Interval for
the Average Y, Given X
Confidence interval estimate for the
expected value of y given a particular xi
Confidence interval for E(Yn1 | Xn1 ) :
1 (x n1 x)2
yˆ n1 t n2,α/2se 2
n (x i x)
51
Prediction Interval for
an Individual Y, Given X
Confidence interval estimate for an actual
observed value of y given a particular xi
1 (x n1 x)2
yˆ n1 t n2,α/2se 1 2
n (x i x)
52
Estimation of Mean Values:
Example
Confidence Interval Estimate for E(Yn+1|Xn+1)
1 (x i x)2
yˆ n1 t n-2,α/2 se 317.85 37.12
n (x i x) 2
1 (Xi X)2
yˆ n1 t n-1,α/2se 1 317.85 102.28
n (Xi X) 2
In Excel, use
PHStat | regression | simple linear regression …
Check the
“confidence and prediction interval for x=”
box and enter the x-value and confidence level
desired
55
Finding Confidence and
Prediction Intervals in Excel
(continued)
Input values
y
57