-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.Rmd
92 lines (56 loc) · 1.97 KB
/
index.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
title: "Developemnt Data Products Course Project"
author: "DHGarcia"
highlighter: highlight.js
output: pdf_document
job: Johns Hopkins Specialization in Data Science
knit: slidify::knit2slides
mode: selfcontained
hitheme: tomorrow
subtitle: MPG Regression Models
framework: io2012
widgets: []
---
## MPG Regression Models
### Introduction
Simple App for the Developemnt Data Products Course Project.
The Goal is to explore the relationship between miles per gallon (MPG)
and a set of variables in the `mtcars` data set provide in R.
--- .class #id
## MPG Regression Models
### DataSet
`mtcars` dataset is use to build our model predicton.
We load the mtcars data and take a look at the variables.
And convert some variables into factors.
```{r factor, cache = FALSE}
mtcars$cyl = factor(mtcars$cyl)
mtcars$vs = factor(mtcars$vs)
mtcars$am = factor(mtcars$am)
mtcars$gear = factor(mtcars$gear)
mtcars$carb = factor(mtcars$carb)
levels(mtcars$am) = c("AT", "MT")
str(mtcars)
```
--- .class #id
## Model Selection
The user can select different set of variables to create the regreesion model.
```{r select,echo =FALSE, cache = FALSE}
selectInput("variable", "Variable:",
c("Transmission" = "am",
"Transmission and Cylinders" = "am + cyl",
"Transmission and Cylinders and Displacement" = "am + cyl + disp",
"Transmission and Cylinders and Displacement and Horsepower" = "am + cyl + disp + hp",
"Transmission and Cylinders and Displacement and Horsepower and Weight" = "am + cyl + disp+ hp + wt")
)
```
The model will be of the form.
```{r model1, cache = FALSE}
model1 <- lm(mpg ~ am, mtcars)
```
--- .class #id
## Output
The main panel will show the residual plot and the summary of the compute model.
```{r figure3, cache = FALSE}
par(mfrow = c(2, 2))
plot(model1)
```