## [1] 32 11
## 'data.frame': 32 obs. of 11 variables:
## $ mpg : num 21 21 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 ...
## $ cyl : Ord.factor w/ 3 levels "4"<"6"<"8": 2 2 1 2 3 2 3 1 1 2 ...
## $ disp: num 160 160 108 258 360 ...
## $ hp : num 110 110 93 110 175 105 245 62 95 123 ...
## $ drat: num 3.9 3.9 3.85 3.08 3.15 2.76 3.21 3.69 3.92 3.92 ...
## $ wt : num 2.62 2.88 2.32 3.21 3.44 ...
## $ qsec: num 16.5 17 18.6 19.4 17 ...
## $ vs : Factor w/ 2 levels "V","S": 1 1 2 2 1 2 1 2 2 2 ...
## $ am : Factor w/ 2 levels "automatic","manual": 2 2 2 1 1 1 1 1 1 1 ...
## $ gear: Ord.factor w/ 3 levels "3"<"4"<"5": 2 2 2 1 1 1 1 2 2 2 ...
## $ carb: Ord.factor w/ 6 levels "1"<"2"<"3"<"4"<..: 4 4 1 1 2 1 4 2 2 4 ...
## mpg cyl disp hp drat
## Min. :10.40 4:11 Min. : 71.1 Min. : 52.0 Min. :2.760
## 1st Qu.:15.43 6: 7 1st Qu.:120.8 1st Qu.: 96.5 1st Qu.:3.080
## Median :19.20 8:14 Median :196.3 Median :123.0 Median :3.695
## Mean :20.09 Mean :230.7 Mean :146.7 Mean :3.597
## 3rd Qu.:22.80 3rd Qu.:326.0 3rd Qu.:180.0 3rd Qu.:3.920
## Max. :33.90 Max. :472.0 Max. :335.0 Max. :4.930
## wt qsec vs am gear carb
## Min. :1.513 Min. :14.50 V:18 automatic:19 3:15 1: 7
## 1st Qu.:2.581 1st Qu.:16.89 S:14 manual :13 4:12 2:10
## Median :3.325 Median :17.71 5: 5 3: 3
## Mean :3.217 Mean :17.85 4:10
## 3rd Qu.:3.610 3rd Qu.:18.90 6: 1
## Max. :5.424 Max. :22.90 8: 1
Our dataset has 11 variables with 32 observations.
Most cars have a fuel consumption of between 15 to 24.
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 10.40 15.43 19.20 20.09 22.80 33.90
Most cars have displacement of between 100 to 170.
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 71.1 120.8 196.3 230.7 326.0 472.0
Most cars have horsepower of below 200.
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 52.0 96.5 123.0 146.7 180.0 335.0
Most cars have engines with 8 cylinders.
Most cars have engines with V shape.
Most cars in the dataset have an automatic transmission.
There are 32 cars in our dataset with 11 variables (mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb). Categorical variables are cyl, vs, am, gear, carb.
Other observations: A majority of cars have 3 forward gears. There are also a numbers of cars with 4 forward gears. The mean fuel consumption of the cars is 20mpg. The median horsepower is 123. Most cars have less than 5 carburetors.
The main feature of interest in this dataset is mpg which is the fuel consumption of the cars. I want to know which features of car influence fuel consumption and can be used to predict the fuel consumption of a car.
Cyl, vs, am, disp, hp, and gear are features that may influence fuel consumption of a car.
## mpg disp hp drat wt qsec
## mpg 1.00 -0.85 -0.78 0.68 -0.87 0.42
## disp -0.85 1.00 0.79 -0.71 0.89 -0.43
## hp -0.78 0.79 1.00 -0.45 0.66 -0.71
## drat 0.68 -0.71 -0.45 1.00 -0.71 0.09
## wt -0.87 0.89 0.66 -0.71 1.00 -0.17
## qsec 0.42 -0.43 -0.71 0.09 -0.17 1.00
## corrplot 0.84 loaded
Mpg correlates moderately with rear axle ratio and quarter mile time. As the rear axle ratio and quarter mile time increase the variance in the fuel consumption increases. Mpg had a strong negative correlation with displacement and weight of the car.
The displacement of the car tend to correlate with the horsepower of the car. The higher the displacement of the car the more the horsepower the car will have.
The displacement of the car and weight of the car have a strong and positive correlation with each other. The mpg of the car also correlated with the rear axle ratio of the car but not strongly.
Cars with automatic transmission had low fuel consumption compared to manual transmission. But cars with manual transmission had a wide distribution of fuel consumption.
Car with engines that have 8 cylinders had low fuel consumption compared to engines that have 4 cylinders. This was interesting as cars with 8 cylinders are assumed to consume alot fuel.
The distribution of fuel consumption of the cars seem to skew to the right. Most cars have a fuel consumption of below 25 mpg.
## Description Two Cars with 4 cylinders in their engines have a high fuel consumption. Some cars with 8 cylinders had a fuel consumption of 10 which was seen as an outlier.
## Description Three Cars with 4 and 5 forward gears had high fuel consumption compared to cars with 3 forward gears which had low fuel consumption. Cars with 5 forward gears had a wide distribution of fuel consumption compared to cars with 3 and 4 forward gears.
The mtcars dataset contains information about 32 cars. The dataset comprise of information about fuel consumption and design and performance of the 32 cars.I did some exploration to understand the variables in the dataset. I explored relationship between the fuel consumption of cars with other variables.
There was a good relationship between the fuel consumption of a car with their rear axle ratio. A moderate relationship was also observed between fuel consumption (mpg) and quarter mile time (qsec). The surprising thing was that mpg has negative correlation with features like disp, hp, and wt which i assumed would have positive correlation the fuel consumption of a car.
The limitation of this dataset is it had 32 observations only. The dataset did not also include other cars from other car manufacturers. Give the dataset contains data from 1974 the analysis of fuel consumption of the cars would not reflect on the cars from this century since there have been technological advancement in car manufacturing.