Gil Huesca
9/28/2020
This presentation introduce you to the linear model generator for the mtcars data set. The data was extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973–74 models). It has 32 observations on 11 (numeric) variables.
(from the dataset description)
You find the app in https://gilhuesca.shinyapps.io/GilShinyFirstAppDDPCourse/.
These are the steps to use the application
Note: If both variables are the same, no model is generated and no plot is displayed.
If you choose mpg as dependent variable and disp as predictor you will get the following output.
Lineal model for: mpg~disp
yy <- mtcars[,which(names(mtcars)=="mpg")]
xx <- mtcars[,which(names(mtcars)=="disp")]
lm <- lm(mpg~disp,data = mtcars)
paste("Intercept: ",lm$coefficients[1]," *** ","disp",": ",lm$coefficients[2],sep="")## [1] "Intercept: 29.5998547561639 *** disp: -0.0412151199627861"