Upload
manu-sharma
View
16
Download
1
Embed Size (px)
DESCRIPTION
Multivariate Regression Stepwise Analysis Report Business Case Study
Citation preview
pdfcrowd.comPRO version Are you a developer? Try out the HTML to PDF API
ProjectProject Summary- In the data set mtcars there are 11 variables, 7(mpg=Miles/gallon, cyl=no.ofcylinders,disp=displacement,hp=grosshorsepower, drat=Rear axle ratio,wt=weight,qsec=1/4 mile time) of them arequantitative varibles and 4(vs=V/s, am=transmission,gear=no.of forward gears,carb=no.ofcarburetors) of them arequalititative variables. We will find and predict the relation between the variable mpg(Resonse variable) and the otherpredictors variables including am (transmission mode)variable which is a categorical variable also. We will use the forwardgoing adjusted R2 method and also will discover if interaction variable can also improve the model. Besides looking at theadjusted R2 method in the forward going techniques, We will also consider the p values of the prediction varibales.Andafter evaluting the models we found that most optimized model has adjusted R2 value as 81.51.And all predictor variableshas their p values less than the 0.05 which is also less than the significance level. Also after setting the model we havechecked the normalization of residuals for the fitted model and that also is quite good and normal with lessskewedness.And which transmission system(am=1 or 0)is better for mpg can not be answered. Because At lower weights2.62 manual transmission is better(am=1) is 1 mpg higher than automatic transmisssion at same weight 2.62 but at heavyweight 5.42, am=1 has negative mpg compared to am=0(automatic transmission). So after styding further the model wefound out it can not be answered that which am(transmission system) is better for mpg becuase few other predictors arealso responsible in this case such as wt(weight)
data(mtcars)
Going ahead with a forward selection-adjusted R2 method also applying interactive variables later in the models
a=lm(mpg~am,data=mtcars)
b=lm(mpg~wt+am,data=mtcars)
c=lm(mpg~wt+am+cyl,data=mtcars)
d=lm(mpg~wt+am+cyl+disp,data=mtcars)
d=lm(mpg~wt+am+cyl+hp,data=mtcars)
pdfcrowd.comPRO version Are you a developer? Try out the HTML to PDF API
e=lm(mpg~wt+am+cyl+hp+drat,data=mtcars)
f=lm(mpg~wt+am+cyl+hp+qsec,data=mtcars)
g=lm(mpg~wt+am+cyl+hp+gear,data=mtcars)
h=lm(mpg~wt+am+cyl+hp+qsec+carb,data=mtcars)
h=lm(mpg~wt+am+am*wt,data=mtcars)
summary(h)
##
## Call:
## lm(formula = mpg ~ wt + am + am * wt, data = mtcars)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.600 -1.545 -0.533 0.901 6.091
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 31.416 3.020 10.40 4.0e-11 ***
## wt -3.786 0.786 -4.82 4.6e-05 ***
## am 14.878 4.264 3.49 0.0016 **
## wt:am -5.298 1.445 -3.67 0.0010 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.59 on 28 degrees of freedom
## Multiple R-squared: 0.833, Adjusted R-squared: 0.815
## F-statistic: 46.6 on 3 and 28 DF, p-value: 5.21e-11
pdfcrowd.comPRO version Are you a developer? Try out the HTML to PDF API
SO after conducting and setting up different models a,b,c,d,e,f,g,h we observed Adjusted R2 in all te models and also the pvalues for the predictors and we found out after using as an interactive variable in model H R2 adjusted R2 and p values ofpredictors make the best model.SO “h” is the model we will set up as the best fit model now finding out mpg for differenttransmission systems
31.4161-3.759*2.62+14.8784-5.2984*2.62
## [1] 22.56
31.4161-3.759*2.62
## [1] 21.57
Here manual transmission system(am=1) has higher mpg. Lets take an aother example for little higher weight of 5.42
31.4161-3.759*5.42+14.8784-5.2984*5.42
## [1] -2.797
31.4161-3.759*5.42
## [1] 11.04
Here manual transmission has (am=1)negative mpg and automatic (am=0) has higher mpg. So on the basis of just am=0 or1 this question can not be answered. now doing some exploratory anaysis of our model
pdfcrowd.comPRO version Are you a developer? Try out the HTML to PDF API
plot(density(residuals(h)))
oldpar <- par(mfrow = c(2, 2))
pdfcrowd.comPRO version Are you a developer? Try out the HTML to PDF API
plot(h)