Simple Linear Regression

Import data and store regression results

데이터 불러오기 및 단순회귀분석 결과 저장

cars = read.csv("data/cars.csv")
attach(cars)
out1=lm(dist~speed,data=cars)
out2=lm(log(dist)~speed,data=cars)
out3=lm(sqrt(dist)~speed,data=cars)
out4=lm(sqrt(dist)~speed-1,data=cars)

Including Plots

##
## Call:
## lm(formula = sqrt(dist) ~ speed - 1, data = cars)
##
## Residuals:
##     Min      1Q  Median      3Q     Max
## -2.2781 -0.6972  0.0208  0.7965  3.3898
##
## Coefficients:
##       Estimate Std. Error t value Pr(>|t|)    
## speed  0.39675    0.01015   39.09   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.167 on 49 degrees of freedom
## Multiple R-squared:  0.9689, Adjusted R-squared:  0.9683
## F-statistic:  1528 on 1 and 49 DF,  p-value: < 2.2e-16

Written on February 16, 2020