Linear Regression
Essay by RAVI shankar • November 28, 2016 • Course Note • 468 Words (2 Pages) • 1,204 Views
Simple Linear Regression
Reression
Problems with Solutions
|
Q1. The values of y and their corresponding values of y are shown in the table below
X | 0 | 1 | 2 | 3 | 4 |
Y | 2 | 3 | 5 | 4 | 6 |
a) Find the least square regression line y = ax + b.
b) Estimate the value of y when x = 10.
Answer:
a) We use a table to calculate a and b.
x | y | x y | x 2 |
0 | 2 | 0 | 0 |
1 | 3 | 3 | 1 |
2 | 5 | 10 | 4 |
3 | 4 | 12 | 9 |
4 | 6 | 24 | 16 |
Σx = 10 | Σy = 20 | Σx y = 49 | Σx2 = 30 |
We now calculate a and b using the least square regression formulas for a and b.
a = (nΣx y - ΣxΣy) / (nΣx2 - (Σx)2) = (5*49 - 10*20) / (5*30 - 102) = 0.9
b = (1/n)(Σy - a Σx) = (1/5)(20 - 0.9*10) = 2.2
b) Now that we have the least square regression line y = 0.9 x + 2.2, substitute x by 10 to find the value of the corresponding y.
y = 0.9 * 10 + 2.2 = 11.2
Q2. The sales of a company (in million dollars) for each year are shown in the table below.
x (year) | 2005 | 2006 | 2007 | 2008 | 2009 |
y (sales) | 12 | 19 | 29 | 37 | 45 |
a) Find the least square regression line y = ax + b.
b) Use the least squares regression line as a model to estimate the sales of the company in 2012.
Answer:
a) We first change the variable x into t such that t = x - 2005 and therefore t represents the number of years after 2005. Using t instead of x makes the numbers smaller and therefore managable. The table of values becomes.
...
...