Heng Kar
28 Feb 2016
This analysis is to explore the relationship between a set of variables on miles per gallon (MPG) (outcome). The analysis are particularly focus in the following two questions:
From plot, we can see some higher correlations between variables like
The regression model will predict MPG based on, Transmission type, Weight and Horsepower.
Linear regression model:
fit <- lm(mpg ~ am + wt + hp, data = mtcars)
Coefficient:
| Estimate | Std. Error | t value | Pr(>|t|) | |
|---|---|---|---|---|
| (Intercept) | 34.0028751 | 2.6426593 | 12.866916 | 0.0000000 |
| amManual | 2.0837101 | 1.3764202 | 1.513862 | 0.1412682 |
| wt | -2.8785754 | 0.9049705 | -3.180850 | 0.0035740 |
| hp | -0.0374787 | 0.0096054 | -3.901830 | 0.0005464 |
Shiny App Screen Shot