For this project, the main concentration will be identifying the contributing factors that actively influence the car consumption, that is the miles consumed per gallon on an individual vehicle. The analysis is mainly influenced by the fact that different vehicles are priced based on factors such as the mileage per gallon statistic, and on an actual real world issue as the mileage per gallon factor greatly influences the resale value of each model. For instance, a vehicle with a high mileage per gallon may seem to be of excessive consumption and that has a little fuel economy, and thus unaffordable to many.
The main goal of this blog post is therefore is to find out whether there exists any relationship between the mileage per gallon variable and other factors such as the weight, horsepower, acceleration which actively influence the consumption level of a vehicle.
Our data consideration was from the UCL library, https://archive.ics.uci.edu/ml/datasets/Auto+MPG.
cars <- read.table("https://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data", header = FALSE)
colnames(cars) <- c("mpg","cylinders","displacement","horsepower","weight","acceleration","model year","origin","car name")
The main objective of the research was to determine whether there were any influential factors that actively altered the record of car mileage per gallon in the active dataset. The research problem tried to answer the question on whether it would be possible to make predictions on car mileage per gallon using other underlying factors, which were all in the selected dataset
There were 397 cases where the effective analysis would only be achieved by considering all the datapoints since the initial assumption was that they were all influential. moreover, there were 8 variables in the dataset, all of which related to the features of a vehicle including the year of manufature, place of origin, the make and model, the engine displacement, number of cylinders as well as the horsepower.
nrow(cars)
## [1] 398
There were 397 cases.
The dataset in consideration is the Auto Mpg dataset, which was obtained from the UCI machine learning repository website. https://archive.ics.uci.edu/ml/datasets/Auto+MPG.
Since the study involves numeric variables, it will be an observational study, and will further be complemented by a case analysis using regression analysis with the mileage per gallon column being our dependent variable.
Mile per gallon (mpg) is the dependent variable. It’s continuous.
The independent variables in the analysis are all the other columns except the mileage per gallon one, as seen below.
colnames(cars)[2:8]
## [1] "cylinders" "displacement" "horsepower" "weight"
## [5] "acceleration" "model year" "origin"
In its raw form, the dataset structure is in its required state, with all the variables being either in their numeric form, while the horspower and car name being factor variables.
str(cars)
## 'data.frame': 398 obs. of 9 variables:
## $ mpg : num 18 15 18 16 17 15 14 14 14 15 ...
## $ cylinders : int 8 8 8 8 8 8 8 8 8 8 ...
## $ displacement: num 307 350 318 304 302 429 454 440 455 390 ...
## $ horsepower : Factor w/ 94 levels "?","100.0","102.0",..: 17 35 29 29 24 42 47 46 48 40 ...
## $ weight : num 3504 3693 3436 3433 3449 ...
## $ acceleration: num 12 11.5 11 12 10.5 10 9 8.5 10 8.5 ...
## $ model year : int 70 70 70 70 70 70 70 70 70 70 ...
## $ origin : int 1 1 1 1 1 1 1 1 1 1 ...
## $ car name : Factor w/ 305 levels "amc ambassador brougham",..: 50 37 232 15 162 142 55 224 242 2 ...
observing the First and last few rows of the data
head(cars)
tail(cars)
summary(cars)
## mpg cylinders displacement horsepower
## Min. : 9.00 Min. :3.000 Min. : 68.0 150.0 : 22
## 1st Qu.:17.50 1st Qu.:4.000 1st Qu.:104.2 90.00 : 20
## Median :23.00 Median :4.000 Median :148.5 88.00 : 19
## Mean :23.51 Mean :5.455 Mean :193.4 110.0 : 18
## 3rd Qu.:29.00 3rd Qu.:8.000 3rd Qu.:262.0 100.0 : 17
## Max. :46.60 Max. :8.000 Max. :455.0 75.00 : 14
## (Other):288
## weight acceleration model year origin
## Min. :1613 Min. : 8.00 Min. :70.00 Min. :1.000
## 1st Qu.:2224 1st Qu.:13.82 1st Qu.:73.00 1st Qu.:1.000
## Median :2804 Median :15.50 Median :76.00 Median :1.000
## Mean :2970 Mean :15.57 Mean :76.01 Mean :1.573
## 3rd Qu.:3608 3rd Qu.:17.18 3rd Qu.:79.00 3rd Qu.:2.000
## Max. :5140 Max. :24.80 Max. :82.00 Max. :3.000
##
## car name
## ford pinto : 6
## amc matador : 5
## ford maverick : 5
## toyota corolla: 5
## amc gremlin : 4
## amc hornet : 4
## (Other) :369
From the summary statistics, we can observe that the maximum weight of the cars in consideration is 5140, while the minimum is 1613. The mean and median, on the other hand, are relatively close to each other, suggesting that the distribution of the data may be close to a normal distribution
boxplot(cars$mpg~cars$cylinders,main = "Mileage by Cylinders", outline=F, col="green")
From the boxplot above, it is evident that car mileage per gallon is high on cars with 4 cylinders, and low on cars with 8 cylinders. Similarly, car mileage per gallon differs with region, as seen on the boxplot below, with Origin 3 posing the cars with the highest level of miles per gallon.
boxplot(cars$mpg~cars$origin,main = "Milage by origin", outline=F, col="blue")
ggplot(cars, aes(x = weight, y = mpg)) +
geom_point(colour="red")+theme_light()+
labs(x = "Weight ",y = "MPG",
title = "Miles per gallon vs weight")
From the above plot, we can ascertain that indeed there exists a relationship between the weight of a car and the respective miles per gallon statistic. the trend shown by the scatterplot means that an increase in the weight of the vehicle results to a reduction in the miles per gallon consumed. This is a factor that may realistically hold, as weight increase demands more power, and as a result, more fuel is consumed.
hist(cars$mpg,main="Distribution of Mpg", xlab="Mpg" ,col="red")
From the above mileage distribution, we can see that the datapoints tend to follow a normal distribution, with the mean points being concentrated more at the center, and thus the shape of the histogram.
cor(cars[,c(1,2,3,5,6,7)])
## mpg cylinders displacement weight acceleration
## mpg 1.0000000 -0.7753963 -0.8042028 -0.8317409 0.4202889
## cylinders -0.7753963 1.0000000 0.9507214 0.8960168 -0.5054195
## displacement -0.8042028 0.9507214 1.0000000 0.9328241 -0.5436841
## weight -0.8317409 0.8960168 0.9328241 1.0000000 -0.4174573
## acceleration 0.4202889 -0.5054195 -0.5436841 -0.4174573 1.0000000
## model year 0.5792671 -0.3487458 -0.3701642 -0.3065643 0.2881370
## model year
## mpg 0.5792671
## cylinders -0.3487458
## displacement -0.3701642
## weight -0.3065643
## acceleration 0.2881370
## model year 1.0000000
The above correlation matrix shows that there exists a high correlation between the mpg column variable and cylinder, displacement as well as weight. this may act as a support to further research, as high correlation always implies that the respective variables hold a tight relationship.
From the summary statistics, inferences were made on whether the data had any missing observations, as well as whether the variables exhibited strong correlation. The underlying problem was to determine whether there was any existing relation between the car mile per gallon and the other variables in the dataset. To ascertain on whether there exists a relationship between the mpg variable and other related variables, we proceed and fit a regression model, which will help in analysing any predictive power that these variables have.
LinearModel.1 <- lm(mpg ~ acceleration + cylinders +
displacement + horsepower + origin + weight, data=cars)
summary(LinearModel.1)
##
## Call:
## lm(formula = mpg ~ acceleration + cylinders + displacement +
## horsepower + origin + weight, data = cars)
##
## Residuals:
## Min 1Q Median 3Q Max
## -11.873 -1.895 0.000 1.370 15.265
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.729e+01 2.924e+00 12.752 < 2e-16 ***
## acceleration -2.934e-01 1.358e-01 -2.160 0.031539 *
## cylinders -1.423e-01 5.293e-01 -0.269 0.788184
## displacement -4.278e-03 1.174e-02 -0.364 0.715944
## horsepower100.0 -6.783e+00 1.833e+00 -3.701 0.000256 ***
## horsepower102.0 -8.240e+00 3.960e+00 -2.081 0.038302 *
## horsepower103.0 -8.392e+00 3.935e+00 -2.133 0.033765 *
## horsepower105.0 -4.733e+00 1.933e+00 -2.448 0.014920 *
## horsepower107.0 -7.162e+00 3.970e+00 -1.804 0.072228 .
## horsepower108.0 -1.093e+01 4.046e+00 -2.702 0.007280 **
## horsepower110.0 -6.180e+00 1.842e+00 -3.354 0.000898 ***
## horsepower112.0 -8.624e+00 2.604e+00 -3.312 0.001038 **
## horsepower113.0 -5.099e+00 3.931e+00 -1.297 0.195618
## horsepower115.0 -3.523e+00 2.275e+00 -1.549 0.122540
## horsepower116.0 -5.394e+00 4.088e+00 -1.319 0.188091
## horsepower120.0 -7.994e+00 2.579e+00 -3.100 0.002122 **
## horsepower122.0 -1.077e+01 4.068e+00 -2.648 0.008528 **
## horsepower125.0 -5.713e+00 2.794e+00 -2.045 0.041730 *
## horsepower129.0 -1.033e+01 3.264e+00 -3.163 0.001720 **
## horsepower130.0 -8.983e+00 2.624e+00 -3.423 0.000706 ***
## horsepower132.0 1.575e+00 4.124e+00 0.382 0.702800
## horsepower133.0 -1.105e+01 4.043e+00 -2.733 0.006648 **
## horsepower135.0 -5.838e+00 4.117e+00 -1.418 0.157236
## horsepower137.0 -9.876e+00 4.165e+00 -2.371 0.018380 *
## horsepower138.0 -7.726e+00 4.211e+00 -1.835 0.067555 .
## horsepower139.0 -6.804e+00 3.284e+00 -2.072 0.039121 *
## horsepower140.0 -7.650e+00 2.548e+00 -3.002 0.002909 **
## horsepower142.0 -8.200e+00 4.191e+00 -1.956 0.051340 .
## horsepower145.0 -8.795e+00 2.570e+00 -3.422 0.000707 ***
## horsepower148.0 -8.696e+00 4.329e+00 -2.009 0.045454 *
## horsepower149.0 -7.064e+00 4.227e+00 -1.671 0.095722 .
## horsepower150.0 -9.538e+00 2.329e+00 -4.096 5.42e-05 ***
## horsepower152.0 -9.310e+00 4.263e+00 -2.184 0.029767 *
## horsepower153.0 -9.829e+00 3.387e+00 -2.902 0.003984 **
## horsepower155.0 -8.009e+00 3.409e+00 -2.349 0.019459 *
## horsepower158.0 -1.045e+01 4.284e+00 -2.439 0.015316 *
## horsepower160.0 -1.181e+01 3.476e+00 -3.398 0.000770 ***
## horsepower165.0 -9.892e+00 2.812e+00 -3.518 0.000503 ***
## horsepower167.0 -1.027e+01 4.479e+00 -2.293 0.022561 *
## horsepower170.0 -9.253e+00 2.956e+00 -3.131 0.001917 **
## horsepower175.0 -1.020e+01 2.951e+00 -3.456 0.000627 ***
## horsepower180.0 -1.032e+01 2.924e+00 -3.528 0.000484 ***
## horsepower190.0 -9.656e+00 3.272e+00 -2.951 0.003416 **
## horsepower193.0 -1.228e+01 4.202e+00 -2.922 0.003747 **
## horsepower198.0 -9.691e+00 3.785e+00 -2.560 0.010951 *
## horsepower200.0 -1.302e+01 4.214e+00 -3.090 0.002189 **
## horsepower208.0 -1.215e+01 4.547e+00 -2.671 0.007976 **
## horsepower210.0 -1.240e+01 4.263e+00 -2.909 0.003892 **
## horsepower215.0 -1.099e+01 3.393e+00 -3.240 0.001330 **
## horsepower220.0 -1.020e+01 4.667e+00 -2.185 0.029666 *
## horsepower225.0 -1.088e+01 3.536e+00 -3.077 0.002284 **
## horsepower230.0 -8.439e+00 4.483e+00 -1.882 0.060760 .
## horsepower46.00 -3.483e+00 3.049e+00 -1.142 0.254294
## horsepower48.00 1.504e+01 2.684e+00 5.604 4.76e-08 ***
## horsepower49.00 -1.026e+00 3.949e+00 -0.260 0.795233
## horsepower52.00 4.363e+00 2.451e+00 1.780 0.076127 .
## horsepower53.00 7.451e-01 3.030e+00 0.246 0.805949
## horsepower54.00 -4.933e+00 4.001e+00 -1.233 0.218561
## horsepower58.00 6.111e+00 3.005e+00 2.033 0.042885 *
## horsepower60.00 1.381e+00 2.262e+00 0.611 0.541923
## horsepower61.00 5.930e-01 3.957e+00 0.150 0.880960
## horsepower62.00 2.251e+00 2.975e+00 0.757 0.449812
## horsepower63.00 5.478e+00 2.564e+00 2.136 0.033452 *
## horsepower64.00 9.736e+00 3.915e+00 2.487 0.013436 *
## horsepower65.00 4.587e+00 1.948e+00 2.355 0.019189 *
## horsepower66.00 6.147e+00 3.916e+00 1.570 0.117582
## horsepower67.00 2.571e+00 1.865e+00 1.379 0.168917
## horsepower68.00 9.349e-01 2.141e+00 0.437 0.662694
## horsepower69.00 1.757e+00 2.582e+00 0.680 0.496723
## horsepower70.00 2.220e+00 1.823e+00 1.218 0.224305
## horsepower71.00 -1.003e+00 2.191e+00 -0.458 0.647554
## horsepower72.00 -5.086e+00 2.103e+00 -2.418 0.016192 *
## horsepower74.00 2.939e+00 2.569e+00 1.144 0.253566
## horsepower75.00 -1.700e+00 1.795e+00 -0.947 0.344255
## horsepower76.00 1.705e+00 2.347e+00 0.727 0.468020
## horsepower77.00 -3.988e-01 3.955e+00 -0.101 0.919764
## horsepower78.00 -2.072e+00 2.083e+00 -0.994 0.320891
## horsepower79.00 -4.912e-01 2.948e+00 -0.167 0.867755
## horsepower80.00 2.059e-01 2.012e+00 0.102 0.918542
## horsepower81.00 -3.331e+00 2.948e+00 -1.130 0.259405
## horsepower82.00 4.494e+00 3.898e+00 1.153 0.249958
## horsepower83.00 -1.055e+00 2.326e+00 -0.453 0.650620
## horsepower84.00 1.646e+00 2.129e+00 0.773 0.440125
## horsepower85.00 -2.973e+00 1.927e+00 -1.543 0.123958
## horsepower86.00 -4.363e+00 2.193e+00 -1.989 0.047571 *
## horsepower87.00 -5.149e+00 2.963e+00 -1.738 0.083253 .
## horsepower88.00 -3.182e+00 1.703e+00 -1.868 0.062691 .
## horsepower89.00 -1.901e+00 3.909e+00 -0.486 0.627149
## horsepower90.00 -3.097e+00 1.699e+00 -1.823 0.069256 .
## horsepower91.00 -9.974e+00 3.926e+00 -2.541 0.011572 *
## horsepower92.00 -1.369e+00 2.111e+00 -0.649 0.517118
## horsepower93.00 -5.530e+00 3.936e+00 -1.405 0.161086
## horsepower94.00 -9.261e+00 3.932e+00 -2.355 0.019145 *
## horsepower95.00 -6.204e+00 1.816e+00 -3.416 0.000722 ***
## horsepower96.00 -3.216e+00 2.615e+00 -1.230 0.219590
## horsepower97.00 -8.331e+00 1.991e+00 -4.183 3.78e-05 ***
## horsepower98.00 -6.338e+00 2.997e+00 -2.115 0.035281 *
## origin 1.578e+00 3.961e-01 3.984 8.51e-05 ***
## weight -2.055e-03 8.886e-04 -2.312 0.021452 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.597 on 299 degrees of freedom
## Multiple R-squared: 0.8405, Adjusted R-squared: 0.7882
## F-statistic: 16.08 on 98 and 299 DF, p-value: < 2.2e-16
From the fitted model, we deduce the following; The multiple and adjusted R squared values of the model are 0.8405 and 0.7882 respectively, which shows that the fitted model manages to explain and predict 84% of the model. The F statistic value too is greater than one unit, proving that indeed there is an existing relationship between the mpg value and its predictors.
From this fitted regression model, we can then fit a stepwise regression model that will help in further identifying the best mpg predictors.
lm2<-step(LinearModel.1)
## Start: AIC=1103.12
## mpg ~ acceleration + cylinders + displacement + horsepower +
## origin + weight
##
## Df Sum of Sq RSS AIC
## - cylinders 1 0.9 3869.4 1101.2
## - displacement 1 1.7 3870.2 1101.3
## <none> 3868.5 1103.1
## - acceleration 1 60.4 3928.9 1107.3
## - weight 1 69.2 3937.6 1108.2
## - origin 1 205.4 4073.8 1121.7
## - horsepower 93 3171.8 7040.3 1155.4
##
## Step: AIC=1101.21
## mpg ~ acceleration + displacement + horsepower + origin + weight
##
## Df Sum of Sq RSS AIC
## - displacement 1 9.3 3878.7 1100.2
## <none> 3869.4 1101.2
## - acceleration 1 61.5 3930.9 1105.5
## - weight 1 68.2 3937.7 1106.2
## - origin 1 205.9 4075.3 1119.8
## - horsepower 93 3185.7 7055.1 1154.3
##
## Step: AIC=1100.17
## mpg ~ acceleration + horsepower + origin + weight
##
## Df Sum of Sq RSS AIC
## <none> 3878.7 1100.2
## - acceleration 1 54.9 3933.6 1103.8
## - weight 1 155.2 4033.9 1113.8
## - origin 1 289.3 4167.9 1126.8
## - horsepower 93 3183.8 7062.5 1152.7
summary(lm2)
##
## Call:
## lm(formula = mpg ~ acceleration + horsepower + origin + weight,
## data = cars)
##
## Residuals:
## Min 1Q Median 3Q Max
## -11.641 -1.902 0.000 1.336 14.903
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.666e+01 2.613e+00 14.026 < 2e-16 ***
## acceleration -2.746e-01 1.330e-01 -2.065 0.039822 *
## horsepower100.0 -7.056e+00 1.801e+00 -3.918 0.000110 ***
## horsepower102.0 -7.987e+00 3.941e+00 -2.026 0.043617 *
## horsepower103.0 -8.423e+00 3.908e+00 -2.155 0.031915 *
## horsepower105.0 -4.963e+00 1.909e+00 -2.600 0.009779 **
## horsepower107.0 -7.415e+00 3.903e+00 -1.900 0.058402 .
## horsepower108.0 -1.130e+01 3.969e+00 -2.847 0.004720 **
## horsepower110.0 -6.412e+00 1.817e+00 -3.528 0.000484 ***
## horsepower112.0 -8.639e+00 2.598e+00 -3.325 0.000994 ***
## horsepower113.0 -5.130e+00 3.922e+00 -1.308 0.191874
## horsepower115.0 -3.613e+00 2.260e+00 -1.598 0.111031
## horsepower116.0 -5.770e+00 4.024e+00 -1.434 0.152667
## horsepower120.0 -8.269e+00 2.524e+00 -3.276 0.001176 **
## horsepower122.0 -1.115e+01 3.990e+00 -2.795 0.005524 **
## horsepower125.0 -6.226e+00 2.699e+00 -2.307 0.021745 *
## horsepower129.0 -1.106e+01 3.136e+00 -3.527 0.000486 ***
## horsepower130.0 -9.560e+00 2.510e+00 -3.809 0.000169 ***
## horsepower132.0 1.225e+00 4.061e+00 0.302 0.763110
## horsepower133.0 -1.112e+01 3.975e+00 -2.797 0.005494 **
## horsepower135.0 -6.528e+00 4.030e+00 -1.620 0.106294
## horsepower137.0 -1.040e+01 4.094e+00 -2.540 0.011598 *
## horsepower138.0 -8.468e+00 4.118e+00 -2.056 0.040619 *
## horsepower139.0 -7.551e+00 3.153e+00 -2.395 0.017244 *
## horsepower140.0 -8.162e+00 2.445e+00 -3.338 0.000951 ***
## horsepower142.0 -8.921e+00 4.103e+00 -2.175 0.030441 *
## horsepower145.0 -9.436e+00 2.459e+00 -3.838 0.000151 ***
## horsepower148.0 -9.150e+00 4.289e+00 -2.133 0.033712 *
## horsepower149.0 -7.672e+00 4.163e+00 -1.843 0.066314 .
## horsepower150.0 -1.015e+01 2.215e+00 -4.581 6.78e-06 ***
## horsepower152.0 -9.935e+00 4.196e+00 -2.368 0.018531 *
## horsepower153.0 -1.049e+01 3.296e+00 -3.184 0.001607 **
## horsepower155.0 -8.567e+00 3.344e+00 -2.562 0.010901 *
## horsepower158.0 -1.101e+01 4.227e+00 -2.606 0.009624 **
## horsepower160.0 -1.245e+01 3.394e+00 -3.668 0.000289 ***
## horsepower165.0 -1.043e+01 2.740e+00 -3.808 0.000170 ***
## horsepower167.0 -1.081e+01 4.412e+00 -2.450 0.014851 *
## horsepower170.0 -9.914e+00 2.842e+00 -3.488 0.000559 ***
## horsepower175.0 -1.087e+01 2.830e+00 -3.841 0.000149 ***
## horsepower180.0 -1.094e+01 2.831e+00 -3.862 0.000137 ***
## horsepower190.0 -1.045e+01 3.102e+00 -3.370 0.000851 ***
## horsepower193.0 -1.259e+01 4.147e+00 -3.037 0.002601 **
## horsepower198.0 -1.043e+01 3.612e+00 -2.888 0.004163 **
## horsepower200.0 -1.343e+01 4.156e+00 -3.232 0.001364 **
## horsepower208.0 -1.290e+01 4.398e+00 -2.932 0.003623 **
## horsepower210.0 -1.283e+01 4.212e+00 -3.046 0.002524 **
## horsepower215.0 -1.171e+01 3.235e+00 -3.621 0.000345 ***
## horsepower220.0 -1.113e+01 4.417e+00 -2.521 0.012229 *
## horsepower225.0 -1.193e+01 3.133e+00 -3.808 0.000170 ***
## horsepower230.0 -9.186e+00 4.368e+00 -2.103 0.036288 *
## horsepower46.00 -3.709e+00 3.032e+00 -1.223 0.222176
## horsepower48.00 1.492e+01 2.674e+00 5.577 5.44e-08 ***
## horsepower49.00 -1.115e+00 3.931e+00 -0.284 0.776855
## horsepower52.00 4.183e+00 2.436e+00 1.717 0.087003 .
## horsepower53.00 4.295e-01 3.003e+00 0.143 0.886380
## horsepower54.00 -5.060e+00 3.990e+00 -1.268 0.205751
## horsepower58.00 5.907e+00 2.987e+00 1.978 0.048892 *
## horsepower60.00 1.173e+00 2.245e+00 0.523 0.601638
## horsepower61.00 3.693e-01 3.939e+00 0.094 0.925367
## horsepower62.00 2.098e+00 2.963e+00 0.708 0.479421
## horsepower63.00 5.561e+00 2.556e+00 2.176 0.030358 *
## horsepower64.00 9.768e+00 3.903e+00 2.502 0.012865 *
## horsepower65.00 4.429e+00 1.932e+00 2.292 0.022619 *
## horsepower66.00 6.134e+00 3.908e+00 1.570 0.117575
## horsepower67.00 2.430e+00 1.852e+00 1.312 0.190417
## horsepower68.00 7.615e-01 2.128e+00 0.358 0.720670
## horsepower69.00 1.639e+00 2.570e+00 0.638 0.524199
## horsepower70.00 2.171e+00 1.816e+00 1.196 0.232754
## horsepower71.00 -1.025e+00 2.186e+00 -0.469 0.639420
## horsepower72.00 -5.246e+00 2.077e+00 -2.526 0.012047 *
## horsepower74.00 2.860e+00 2.562e+00 1.116 0.265297
## horsepower75.00 -1.772e+00 1.789e+00 -0.990 0.322934
## horsepower76.00 1.657e+00 2.330e+00 0.711 0.477599
## horsepower77.00 -4.390e-01 3.947e+00 -0.111 0.911500
## horsepower78.00 -2.119e+00 2.079e+00 -1.019 0.308850
## horsepower79.00 -3.546e-01 2.938e+00 -0.121 0.903994
## horsepower80.00 3.230e-01 2.003e+00 0.161 0.872024
## horsepower81.00 -3.524e+00 2.933e+00 -1.201 0.230583
## horsepower82.00 4.681e+00 3.885e+00 1.205 0.229176
## horsepower83.00 -1.015e+00 2.321e+00 -0.437 0.662104
## horsepower84.00 1.737e+00 2.112e+00 0.823 0.411361
## horsepower85.00 -3.152e+00 1.913e+00 -1.648 0.100358
## horsepower86.00 -4.272e+00 2.185e+00 -1.955 0.051497 .
## horsepower87.00 -5.020e+00 2.953e+00 -1.700 0.090180 .
## horsepower88.00 -3.222e+00 1.698e+00 -1.898 0.058679 .
## horsepower89.00 -1.721e+00 3.892e+00 -0.442 0.658640
## horsepower90.00 -3.201e+00 1.687e+00 -1.897 0.058758 .
## horsepower91.00 -9.858e+00 3.915e+00 -2.518 0.012336 *
## horsepower92.00 -1.330e+00 2.097e+00 -0.634 0.526257
## horsepower93.00 -5.632e+00 3.926e+00 -1.435 0.152468
## horsepower94.00 -9.388e+00 3.921e+00 -2.394 0.017273 *
## horsepower95.00 -6.380e+00 1.801e+00 -3.542 0.000460 ***
## horsepower96.00 -3.245e+00 2.602e+00 -1.247 0.213258
## horsepower97.00 -8.465e+00 1.980e+00 -4.276 2.56e-05 ***
## horsepower98.00 -6.381e+00 2.989e+00 -2.135 0.033608 *
## origin 1.715e+00 3.619e-01 4.738 3.33e-06 ***
## weight -2.472e-03 7.123e-04 -3.471 0.000595 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.59 on 301 degrees of freedom
## Multiple R-squared: 0.8401, Adjusted R-squared: 0.7891
## F-statistic: 16.47 on 96 and 301 DF, p-value: < 2.2e-16
The fitted stepwise regression model shows that the factors influencing the mpg variable are acceleration, weight, origin and horsepower, with all the variables being significant at 5% level of confidence.
This analysis involved an inferential problem on the factors influencing the mileage per gallon statistic, which is one of the most commonly used methods that people refer to when in need of a newer vehicle. Usually, based on personal preferences, individuals end up purchasing vehicles with the lowest mpg level. From our analysis, we did plot a regression model of the mile per gallon model, which upon further analysis, was deduced that the influencial factors included the acceleration, weight of the vehicle, country of origin as well as the horsepower factor. This research may be tackled on a different approach, where one may consider the other numeric variables such as acceleration or horsepower, and determine whether there is any influence from these other variables.