object.size(mtcars)
dim(mtcars)
sapply(mtcars, class)
head(mtcars)
summary(mtcars)
boxplot(mpg~am, data=mtcars, xlab="Transmission", ylab="mpg")
title(main= ("manual=1 & autom=0"))
October 5, 2017
object.size(mtcars)
dim(mtcars)
sapply(mtcars, class)
head(mtcars)
summary(mtcars)
boxplot(mpg~am, data=mtcars, xlab="Transmission", ylab="mpg")
title(main= ("manual=1 & autom=0"))
fit1 <- lm(mpg~ am, data = mtcars) summary(fit1)$coefficients
## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 17.147368 1.124603 15.247492 1.133983e-15 ## am 7.244939 1.764422 4.106127 2.850207e-04
fit2 <- lm(mpg~ ., data = mtcars) fit2 <- step(fit2, direction = "both")
summary(fit2)$coefficients
## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 9.617781 6.9595930 1.381946 1.779152e-01 ## wt -3.916504 0.7112016 -5.506882 6.952711e-06 ## qsec 1.225886 0.2886696 4.246676 2.161737e-04 ## am 2.935837 1.4109045 2.080819 4.671551e-02
anova(fit1, fit3)
## Analysis of Variance Table ## ## Model 1: mpg ~ am ## Model 2: mpg ~ wt + qsec + am ## Res.Df RSS Df Sum of Sq F Pr(>F) ## 1 30 720.90 ## 2 28 169.29 2 551.61 45.618 1.55e-09 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1