chp2 Linear Regression Problems
chp2 Linear Regression Problems
Practice Problems:
Q1. Find predicted value of y for one epoch and RMSE using Linear Regression. [May – 19]
X 2 3 4 5 6 7 8 9 10
y-Actual 1 3 6 9 11 13 15 17 20
Solution:
x y-Actual 𝒙 − ̅𝒙 𝒚−𝒚 𝒙)𝟐
̅ (𝒙 − ̅ ̅)(𝒚 − 𝒚
(𝒙 − 𝒙 ̅)
2 1 -4 -9.56 16 38.22
3 3 -3 -7.56 9 22.67
4 6 -2 -4.56 4 9.11
5 9 -1 -1.56 1 1.56
6 11 0 0.44 0 0.00
7 13 1 2.44 1 2.44
8 15 2 4.44 4 8.89
9 17 3 6.44 9 19.33
10 20 4 9.44 16 37.78
Sum = 54 95 60 140
Average = 6 10.56
We have linear regression equation as y= b0+b1x
Using least square method,
∑(𝑥𝑖 − 𝑥
̅)(𝑦𝑖 − 𝑦
̅) 140
𝑏1 = 2
= = 2.33
∑(𝑥𝑖 − 𝑥
̅) 60
𝑏0 = 𝑦
̅ − 𝑏1 𝑥
̅ = 10.56 − 2.33 × 6 = −3.42
1
We have 𝑀𝑆𝐸 = ∑𝑛𝑖=1(𝑦𝑖 − (𝑏1 𝑥𝑖 + 𝑏0 ))2
𝑁
𝑏0 = 𝑦
̅ − 𝑏1 𝑥
̅ = 210.83 − 39 × 2015.5 = −78393.7
𝑏0 = 𝑦
̅ − 𝑏1 𝑥
̅ = 74 − 0.58 × 72.17 = 32.14
3. Last year, five randomly selected students took a math aptitude test before they began their
statistics course. The Statistics Department has three questions.
Student Aptitude Test Statistic Grades
1 95 85
2 85 95
3 80 70
4 70 65
5 60 70
i. What linear regression equation best predicts statistics performance, based on math
aptitude scores? [Solution: y = 26.768 + 0.644x]
ii. If a student made an 80 on the aptitude test, what grade would we expect her to
make in statistics? [Solution: y = 78.288]