library(stats)
library(readxl)
veh <- read_excel("D:/PG Business Analytics/AS/Regression/data_test.xlsx")
head(veh)
Now, performing Setpwise Linear Regression to get best fit
step(lm(Sales ~ PassengerCars+OECD+PMI+Confidence+PLR+IIP_perc+IIP+Mahindra_sales+GDP_Agri+GDP_Total+Production+SCO_Prodn+MCY_Prodn+MPD_Prodn+JanD+FebD+MarD+AprD+MayD+JunD+JulD+AugD+SepD+OctD+NovD+Petrol_Delhi_prices+Time_Dummy+Dummy2008,
data = veh))
Using the output to perform Regression
fit<-lm(Sales ~OECD + PMI + PLR + IIP_perc + Production + JanD + FebD +
MarD + AprD + MayD + JunD + JulD + SepD + OctD + NovD + Petrol_Delhi_prices +
Time_Dummy,data = veh)
summary(fit)
Call:
lm(formula = Sales ~ OECD + PMI + PLR + IIP_perc + Production +
JanD + FebD + MarD + AprD + MayD + JunD + JulD + SepD + OctD +
NovD + Petrol_Delhi_prices + Time_Dummy, data = veh)
Residuals:
Min 1Q Median 3Q Max
-66348 -13968 2496 13331 66470
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -5.825e+05 3.626e+05 -1.606 0.111794
OECD 8.724e+03 4.596e+03 1.898 0.061002 .
PMI 5.708e+02 2.500e+02 2.284 0.024831 *
PLR -1.049e+04 5.196e+03 -2.018 0.046662 *
IIP_perc -2.003e+03 8.796e+02 -2.278 0.025200 *
Production 8.629e-01 4.392e-02 19.648 < 2e-16 ***
JanD 2.157e+04 1.134e+04 1.902 0.060464 .
FebD 2.182e+04 1.114e+04 1.959 0.053349 .
MarD 4.076e+04 1.120e+04 3.640 0.000462 ***
AprD 3.499e+04 1.121e+04 3.121 0.002444 **
MayD 3.112e+04 1.131e+04 2.751 0.007237 **
JunD 1.917e+04 1.114e+04 1.720 0.089020 .
JulD -3.479e+04 1.122e+04 -3.100 0.002604 **
SepD 3.951e+04 1.197e+04 3.302 0.001394 **
OctD 5.263e+04 1.236e+04 4.257 5.21e-05 ***
NovD 2.321e+04 1.160e+04 2.001 0.048471 *
Petrol_Delhi_prices 1.833e+03 9.159e+02 2.001 0.048507 *
Time_Dummy -6.251e+03 3.035e+03 -2.060 0.042432 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 26870 on 87 degrees of freedom
Multiple R-squared: 0.9927, Adjusted R-squared: 0.9912
F-statistic: 693 on 17 and 87 DF, p-value: < 2.2e-16
The Best fit output gives an R-square of 0.9927 and Adjusted R-Square of 0.9912. The P-value of 2.2e-16.
Interestingly the sales take a dip in July and are maxinum in the month of October. This can be further explained by seasonality Index.
Also petrol prices have a significant impact on Sales.