

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Simple Linear Regression
Regression expresses a relation used to predict one variable, called the response variable (or ādependentā variable
A sample question This table represent a sample of ten trucks; for each, we have with the age in years and the annual maintenance cost. We want to find a linear equation, using this information, which most closely describes (āpredictsā) the [average] maintenance cost of a truck, based on its age. [Notice how the language tells us the āpredictorā is age and the āresponseā (āpredictedā) is cost.
Truck age cost number (years) ($Thousands) 1 1 3. 2 2 3. 3 2 4. 4 2 5. 5 2 5. 6 3 5. 7 4 7. 8 4 8. 9 5 7. 10 5 9. For this course, we will focus on linear regression in which we look for the linear equation y = b 0 +b 1 x 1 +b 2 x 2 +.. .+bkxk which best fits our data, and will begin with āsimpleā linear regression ā using one predictor. Thus we will have data in pairs ā two different variables (a value of the predictor and a value of the response) observed on the same individual (or sampling unit) and we will be looking for the equation y = b 0 + b 1 x which best describes the relation; later we will look at tests to decide whether we have evidence for a similar relation in the population, and at how to use the relation to make predictions.
The linear regression model (the theory we are using) Our calculations (and decision of what is ābetterā or āworseā fit) are based on the following model (assumptions about the population): There are two random variables X and Y. For each possible value x of X there is a probability distribution of values of Y (Y |x) which fits the following conditions:
The Regression eaquation For any linear equation y = b 0 + b 1 x each data point (xi, yi) gives a āpredicted valueā Ėyi = b 0 + b 1 xi and there is a residual yi ā yĖi which gives the error (difference between the actual value for that point and the prediction for the point). The āline of best fit in the sense of least squaresā or the āregression line for predicting y based on x or the āOLS [stands for āordinary least squaresā] line for y based on xā is the Ėy = b 0 + b 1 x for which the total of the squares of the residuals (y 1 ā yĖ 1 )^2 + (y 2 ā yĖ 2 )^2 + Ā· Ā· Ā· + (yn ā yĖn)^2 [ = (y 1 ā (b 0 + b 1 x))^2 + (y 2 ā (b 0 + b 1 x 2 ))^2 + Ā· Ā· Ā· + (yn ā b(b 0 + b 1 xn))^2 ] is smallest. [If our model is correct, this is the method that will most often bring us closest to the ārealā population line]. Fortunately, some work with calculus (already done for us by some nice people years ago) gives us the following equations (the ānormal equationsā) forā b 0 and b 1 yi = nb 0 + b 1
ā xi xiyi = b 0 + b 1
x^2 i which we can rewrite [after some clever algebra] as
slope = b 1 =
(xi ā ĀÆx)(yi ā ĀÆy) ā (xi ā xĀÆ)^2
(xiyi) ā nxĀÆĀÆy ā (xi ā ĀÆx)^2
, intercept = b 0 = ĀÆy ā b 1 ĀÆx
We would not calculate these by hand but would use a statistics package (in Minitab: Stat>REGRESSION>REGRESSION (See the online Minitab handbook); āResponseā and āPredictorā are columns containing values of those variables (y, x repectively)) or a calculator (Stat>Calc>Linreg(a+bx) or Stat>Calc>Linreg(ax +b) ā it doesnāt matterā on the TI-8x family - List with predictor first, List with response second (See the online āUsing your calculator for statisticsā pages)) The intercept formula tells us that the regression line always goes through the point (ĀÆx, yĀÆ), which seems reasonable and is useful for a ācheap checkā. The slope formula can be rewritten (once we know about the correlation coefficient r)
in the form b 1 = r
sy sx
not prove) that if our model is correct, b 0 and b 1 are unbiased consistent estimators of β 0 and β 1 (averaging the b 0 values obtained from all possible samples of size n gives β 0 ; similarly for b 1 ). This will be very useful when we want to carry out tests and make estimates for the population values of slope and intercept.
Coefficient of determination r^2 : Looking at the sum of squares (of deviations from the mean) for y, (that is SSy =
(yi ā yĀÆ)^2 ) we have the same division into pieces that we used for ANOVA - but SSR - the sum of squares for the regression [the sum of squares of the predictions] takes the place of SSTR ( the sum of squares between groups - the āgroupsā are defined by the x values) and SSE is the sum of the squares of the residuals (the residuals are the āerror of predictionā values) So SST = SSE + SSR, that isā (yi ā yĀÆ)^2 =
(yi ā Ėyi)^2 +
(Ėyi ā yĀÆ)^2 The coefficient of determination measures the proportion of SST (variation in y) that correpsonds to (is explained by) the relation to x:
r^2 =
The value of r^2 tells us how well the data (from the sample) fits a linear model. We need the appropriate hypothesis test structure (described below under āTesting the regression coefficientsā) to decide whether this is good enough to be convincing about the population.
Correlation:
The [sample] correlation coefficient r is given by r = (sign of b 0 )
r^2 (computation from data: r =
n ā 1
ā (^ xi ā ĀÆx sx
yi ā yĀÆ sy
It measures the extent to which the data points follow a straight line and will have a value ranging from ā1 (perfect match to a line with negative slope) through 0 (do not follow a line ā though might follow some other curve nicely) to + (perfect match to a line with positive slope). Like the variance, it is hard to interpret ā the coefficient of determination r^2 has a more concrete meaning [but loses the information about sign]. The correlation in the population is called Ļ.
Standard error of the residuals (āĻā for the regression): Ļ is estimated (from the sample) by:
se =
n ā 2
(yi ā yĖi)^2 n ā 2
(yi ā (b 0 + b 1 xi))^2 n ā 2 This is the value Minitab and your text call āsā. It is the [sample] standard deviation of the residuals; it is also MSE. Note the ān ā 2ā denominator ā there are n ā 2 (not n ā 1) degrees of freedom because we are using both b 0 and b 1 in calculating the residuals.
Repeat of the assumptions of linear regression [will matter for Tests, Confidence Intervals, etc.]:
Testing the regression coefficients ā is there evidence that that there is a linear relation? If there is no linear relation between X and Y, then the [population] regression coefficient β 1 is 0. Thus, to decide āIs there a linear relationā our test is
H 0 : β 1 = 0 [no linear relationship between variables ā values of X are not useful for linear prediction of values of Y] Ha : β 1 6 = 0 [some linear relation between X and Y]