In: Statistics and Probability
MPG |
Horsepower |
Weight |
43.1 |
48 |
1985 |
19.9 |
110 |
3365 |
19.2 |
105 |
3535 |
17.7 |
165 |
3445 |
18.1 |
139 |
3205 |
20.3 |
103 |
2830 |
21.5 |
115 |
3245 |
16.9 |
155 |
4360 |
15.5 |
142 |
4054 |
18.5 |
150 |
3940 |
27.2 |
71 |
3190 |
41.5 |
76 |
2144 |
46.6 |
65 |
2110 |
23.7 |
100 |
2420 |
27.2 |
84 |
2490 |
39.1 |
58 |
1755 |
28.0 |
88 |
2605 |
24.0 |
92 |
2865 |
20.2 |
139 |
3570 |
20.5 |
95 |
3155 |
28.0 |
90 |
2678 |
34.7 |
63 |
2215 |
36.1 |
66 |
1800 |
35.7 |
80 |
1915 |
20.2 |
85 |
2965 |
23.9 |
90 |
3420 |
29.9 |
65 |
2380 |
30.4 |
67 |
3250 |
36.0 |
74 |
1980 |
22.6 |
110 |
2800 |
36.4 |
67 |
2950 |
27.5 |
95 |
2560 |
33.7 |
75 |
2210 |
44.6 |
67 |
1850 |
32.9 |
100 |
2615 |
38.0 |
67 |
1965 |
24.2 |
120 |
2930 |
38.1 |
60 |
1968 |
39.4 |
70 |
2070 |
25.4 |
116 |
2900 |
31.3 |
75 |
2542 |
34.1 |
68 |
1985 |
34.0 |
88 |
2395 |
31.0 |
82 |
2720 |
27.4 |
80 |
2670 |
22.3 |
88 |
2890 |
28.0 |
79 |
2625 |
17.6 |
85 |
3465 |
34.4 |
65 |
3465 |
20.6 |
105 |
3380 |
I am using Excel to solve this problem.
First you copy data into excel then run regression
SUMMARY OUTPUT | ||||||||
Regression Statistics | ||||||||
Multiple R | 0.865689 | |||||||
R Square | 0.749417 | |||||||
Adjusted R Square | 0.738754 | |||||||
Standard Error | 4.176602 | |||||||
Observations | 50 | |||||||
ANOVA | ||||||||
df | SS | MS | F | Significance F | ||||
Regression | 2 | 2451.974 | 1225.987 | 70.28128 | 7.51E-15 | |||
Residual | 47 | 819.8681 | 17.444 | |||||
Total | 49 | 3271.842 | ||||||
Coefficients | Standard Error | t Stat | P-value | Lower 95% | Upper 95% | Lower 95.0% | Upper 95.0% | |
Intercept | 58.15708 | 2.658248 | 21.87797 | 2.76E-26 | 52.80938 | 63.50479 | 52.80938 | 63.50479 |
Horsepower | -0.11753 | 0.032643 | -3.60028 | 0.000763 | -0.1832 | -0.05186 | -0.1832 | -0.05186 |
Weight | -0.00687 | 0.001401 | -4.90349 | 1.16E-05 | -0.00969 | -0.00405 | -0.00969 | -0.00405 |
1) So from the summary we can see that regression coefficients are as below:
b0 = 58.157082, b1 = -0.117525, b2 = -0.006871
So multiple regression equation is :
MPG = 58.157082 - 0.117525 * Horsepower - 0.006871 * Weight
2) b0 ---> When horsepower and weight both are 0, the MPG value is 58.157
b1 ---> For every one unit increase in Horsepower, the MPG value is expected to go down by 0.117525
b2 ---> For every one unit increase in Weight, the MPG value is expected to go down by 0.006871
3) Here the regression coefficent b0 has no practical meaning as this is practically impossible to have a car of zero weight and zero horsepower.
4) To predict using the above model, we can make use of the predict() function as below:
predict(model,newdata = data.frame(Horsepower = 60,Weight = 2000))
= 37.36427
So the model predicts 37.36427 mpg for a car having 60 horsepower and weighing 2000 pounds.
5) Next Step is:
We can use this model for prediction of miles per gallon for cars using horsepower and weight
As value of horsepower and weight increases value of miles per gallon expected to go down.
Here the regression coefficent b0 has no practical meaning as this is practically impossible to have a car of zero weight and zero horsepower.
This two variable horsepower and weight explains 74.94% variability in horsepower and weight but still 25% variability unexplained.
So we can use other information to improve it further like age of car .Also we can use variable selection to improve model further like stepwise regression to choose best set of variable.based on adjusted R^2
==================================================
If you have any doubt please let me know through comment
Please give positive vote if you find this solution helpful. Thank
you!