Executive Summary In this report, mtcars data set is explored/analyzed for relationship between outcome variable mpg (miles for gallon) and a set of predictor/confounder variables. The main objectives of the study are as follows: Is an automatic or manual transmission better for miles per gallon (MPG)? How different is the MPG between automatic and manual transmissions? Simple linear regression tells us that the manual transmission cars give 7.25 miles more on average when compared against auto transmission cars. Howver, when we take into consideration of confounder variables like weight,cylinders and hp manual transmission cars give 1.8 miles more per gallon only. library(datasets) data(mtcars) dim(mtcars)
## [1] 32 11
sapply(mtcars,class)
## mpg cyl disp hp drat wt qsec ## "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" ## vs am gear carb ## "numeric" "numeric" "numeric" "numeric"
We see that variables including our predictor variable – am, are of numeric class. convert dichotomous predictor variable to a factor class and label the levels as Automatic and Manual for better readability. Also, transform some otherconfounder variables to factor class. mtcars$am