Title: Simple Linear Regression Chapter 18
1Lecture 17-18
- Simple Linear Regression (Chapter 18)
- Homework 5 due Tue Apr 1st 3pm.
2Coefficient of determination
- To measure the strength of the linear
relationship we use the coefficient of
determination.
3Coefficient of determination
- To understand the significance of this
coefficient note
The regression model
Overall variability in y
The error
4Coefficient of determination
y2
Two data points (x1,y1) and (x2,y2) of a certain
sample are shown.
Variation in y SSR SSE
y1
x1
x2
Total variation in y
Variation explained by the regression line
Unexplained variation (error)
5Coefficient of determination
- R2 measures the proportion of the variation in y
that is explained by the variation in x.
- R2 takes on any value between zero and one.
- R2 1 Perfect match between the line and the
data points. - R2 0 There are no linear relationship between
x and y.
6Coefficient of determination,Example
- Example 18.5
- Find the coefficient of determination for Example
18.2 what does this statistic tell you about the
model? - Solution
- Solving by hand
7Coefficient of determination
- Using the computer From the regression
output we have
65 of the variation in the auction selling price
is explained by the variation in odometer
reading. The rest (35) remains unexplained
by this model.
818.9 Regression Diagnostics - I
- The three conditions required for the validity of
the regression analysis are - the error variable is normally distributed.
- the error variance is constant for all values of
x. - The errors are independent of each other.
- How can we diagnose violations of these
conditions?
9 Residual Analysis
- Examining the residuals (or standardized
residuals), help detect violations of the
required conditions. - Example 18.2 continued
- Nonnormality.
- Use JMP to save the residuals and to obtain the
Normal Quantile Plot along with the Historgram. - Examine the histogram and look for a bell shaped.
diagram with a mean close to zero. - The points should fall along the straight line in
the Normal Quantile plot.
10(No Transcript)
11Heteroscedasticity
- When the requirement of a constant variance is
violated we have a condition of
heteroscedasticity. - Diagnose heteroscedasticity by plotting the
residual against the predicted y or by plotting
the residual against X variable.
Residual
y
12 Homoscedasticity
- When the requirement of a constant variance is
not violated we have a condition of
homoscedasticity. - Example 18.2 - continued
13 Non Independence of Error Variables
- A time series is constituted if data were
collected over time. - Examining the residuals over time, no pattern
should be observed if the errors are independent. - When a pattern is detected, the errors are said
to be autocorrelated. - Autocorrelation can be detected by graphing the
residuals against time.
14 Non Independence of Error Variables
Patterns in the appearance of the residuals over
time indicates that autocorrelation exists.
Residual
Residual
0
0
Time
Time
Note the runs of positive residuals, replaced by
runs of negative residuals
Note the oscillating behavior of the residuals
around zero.
15 Outliers
- An outlier is an observation that is unusually
small or large. - Several possibilities need to be investigated
when an outlier is observed - There was an error in recording the value.
- The point does not belong in the sample.
- The observation is valid.
- Identify outliers from the scatter diagram.
- It is customary to suspect an observation is an
outlier if its standard residual gt 2
16An influential observation
An outlier
but, some outliers may be very influential
The outlier causes a shift in the regression line
17Outlier, Leverage, Influential Points
- Residual The vertical distance of a point from
the fitted regression line. - Outlier -- An atypical observation, either in the
horizontal (X) or vertical (Y) direction. - Leveraged Observations that are unusual in the
X direction. - Influential Leveraged points which also possess
substantial residual value in the vertical
direction (Y) are influential.
18 Procedure for Regression Diagnostics
- Develop a model that has a theoretical basis.
- Gather data for the two variables in the model.
- Draw the scatter diagram to determine whether a
linear model appears to be appropriate. - Determine the regression equation.
- Check the required conditions for the errors.
- Check the existence of outliers and influential
observations - Assess the model fit.
- If the model fits the data, use the regression
equation.
1918.6 Finance Application Market Model
- One of the most important applications of linear
regression is the market model. - It is assumed that rate of return on a stock (R)
is linearly related to the rate of return on the
overall market. - R b0 b1Rm e
Rate of return on a particular stock
Rate of return on some major stock index
The beta coefficient measures how sensitive the
stocks rate of return is to changes in the
level of the overall market.
20The Market Model, Example
Example 18.6 (Xm18-06)
- Estimate the market model for Nortel, a stock
traded in the Toronto Stock Exchange (TSE). - Data consisted of monthly percentage return for
Nortel and monthly percentage return for all the
stocks.
This is a measure of the stocks market related
risk. In this sample, for each 1 increase in
the TSE return, the average increase in Nortels
return is .8877.
This is a measure of the total market-related
risk embedded in the Nortel stock. Specifically,
31.37 of the variation in Nortels return are
explained by the variation in the TSEs returns.
2118.7 Using the Regression Equation
- Before using the regression model, we need to
assess how well it fits the data.
- If we are satisfied with how well the model fits
the data, we can use it to predict the values of
y. - To make a prediction we use
- Point prediction, and
- Interval prediction
22Point Prediction
- Example 18.7
- Predict the selling price of a three-year-old
Taurus with 40,000 miles on the odometer (Example
18.2).
- It is predicted that a 40,000 miles car would
sell for 14,575. - How close is this prediction to the real price?
23Interval Estimates
- Two intervals can be used to discover how closely
the predicted value will match the true value of
y. - Prediction interval predicts y for a given
value of x, - Confidence interval estimates the average y for
a given x.
24Interval Estimates,Example
- Example 18.7 - continued
- Provide an interval estimate for the bidding
price on a Ford Taurus with 40,000 miles on the
odometer. - Two types of predictions are required
- A prediction for a specific car
- An estimate for the average price per car
25Interval Estimates,Example
- Solution
- A prediction interval provides the price estimate
for a single car
t.025,98 Approximately
26Interval Estimates,Example
- Solution continued
- A confidence interval provides the estimate of
the mean price per car for a Ford Taurus with
40,000 miles reading on the odometer. - The confidence interval (95)
27The effect of the given xg on the length of the
interval
- As xg moves away from x the interval becomes
longer. That is, the shortest interval is found
at x.
28The effect of the given xg on the length of the
interval
- As xg moves away from x the interval becomes
longer. That is, the shortest interval is found
at x.
29The effect of the given xg on the length of the
interval
- As xg moves away from x the interval becomes
longer. That is, the shortest interval is found
at x.
3018.8 Coefficient of Correlation
- The coefficient of correlation is used to measure
the strength of association between two
variables. - The coefficient values range between -1 and 1.
- If r -1 (negative association) or r 1
(positive association) every point falls on the
regression line. - If r 0 there is no linear pattern.
- The coefficient can be used to test for linear
relationship between two variables.
31Testing the coefficient of correlation
- To test the coefficient of correlation for linear
relationship between X and Y - X and Y must be observational
- X and Y are bivariate normally distributed
32Testing the coefficient of correlation
- When no linear relationship exist between the two
variables, r 0. - The hypotheses are
- H0 r 0H1 r ¹ 0
- The test statistic is
The statistic is Student t distributed with d.f.
n - 2, provided the variables are bivariate
normally distributed.
33Testing the Coefficient of correlation
- Foreign Index Funds (Index)
- A certain investor prefers the investment in an
index mutual funds constructed by buying a wide
assortment of stocks. - The investor decides to avoid the investment in a
Japanese index fund if it is strongly correlated
with an American index fund that he owns. - From the data shown in Index.xls should he avoid
the investment in the Japanese index fund?
34Testing the Coefficient of correlation
- Foreign Index Funds
- A certain investor prefers the investment in an
index mutual funds constructed by buying a wide
assortment of stocks. - The investor decides to avoid the investment in a
Japanese index fund if it is strongly correlated
with an American index fund that he owns. - From the data shown in Index.xls should he avoid
the investment in the Japanese index fund?
35Testing the Coefficient of Correlation,Example
- Solution
- Problem objective Analyze relationship between
two interval variables. - The two variables are observational (the return
for each fund was not controlled). - We are interested in whether there is a linear
relationship between the two variables, thus, we
need to test the coefficient of correlation
36Testing the Coefficient of Correlation,Example
- Solution continued
- The hypothesesH0 r 0H1 r ¹ 0.
- Solving by hand
- The rejection regiont gt ta/2,n-2 t.025,59-2
2.000. - The sample coefficient of correlation Cov(x,y)
.001279 sx .0509 sy 0512 r
cov(x,y)/sxsy.491
37Testing the Coefficient of Correlation,Example
38 Spearman Rank Correlation Coefficient
- The Spearman rank test is a nonparametric
procedure. - The procedure is used to test linear
relationships between two variables when the
bivariate distribution is nonnormal. - Bivariate nonnormal distribution may occur when
- at least one variable is ordinal, or
- both variables are interval but at least one
variable is not normal.
39 Spearman Rank Correlation Coefficient
- The hypotheses are
- H0 rs 0
- H1 rs ¹ 0
- The test statistic iswhere a and b are the
ranks of x and y respectively.
- For a large sample (n gt 30) rs is approximately
normally distributed
40Spearman Rank Correlation Coefficient,Example
- Example 18.8 (Xm18-08)
- A production manager wants to examine the
relationship between - Aptitude test score given prior to hiring, and
- Performance rating three months after starting
work. - A random sample of 20 production workers was
selected. The test scores as well as performance
rating was recorded.
41Spearman Rank Correlation Coefficient,Example
Scores range from 0 to 100
Scores range from 1 to 5
42Spearman Rank Correlation Coefficient,Example
- Solution
- The problem objective is to analyze the
relationship between two variables.(Note
Performance rating is ordinal.)
- The hypotheses are
- H0 rs 0
- H1 rs 0
- The test statistic is rs, and the rejection
region is rs gt rcritical (taken from the
Spearman rank correlation table).
43Spearman Rank Correlation Coefficient,Example
Ties are broken by averaging the ranks.
- Solving by hand
- Rank each variable separately.
- Calculate sa 5.92 sb 5.50 cov(a,b) 12.34
- Thus rs cov(a,b)/sasb .379.
- The critical value for a .05 and n 20 is .450.
44Spearman Rank Correlation Coefficient,Example
Conclusion Do not reject the null
hypothesis. At 5 significance level there is
insufficient evidence to infer that the two
variables are related to one another.
45Spearman Rank Correlation Coefficient,Example
- Excel Solution (Data Analysis Plus Xm18-08)
gt 0.05