LINEAR MODEL
library(datasets)
data(mtcars)
ls(mtcars)
## [1] "am" "carb" "cyl" "disp" "drat" "gear" "hp" "mpg" "qsec" "vs"
## [11] "wt"
reg = lm(wt~cyl + hp, data=mtcars)
summary(reg)
##
## Call:
## lm(formula = wt ~ cyl + hp, data = mtcars)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.8446 -0.4442 -0.1562 0.3092 1.4262
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.5820880 0.4348124 1.339 0.19107
## cyl 0.4177733 0.1142980 3.655 0.00101 **
## hp 0.0003422 0.0029772 0.115 0.90930
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.6298 on 29 degrees of freedom
## Multiple R-squared: 0.6125, Adjusted R-squared: 0.5858
## F-statistic: 22.92 on 2 and 29 DF, p-value: 1.072e-06