data("faithful")
model1 <- lm(eruptions ~ waiting, data = faithful)
summary(model1)
##
## Call:
## lm(formula = eruptions ~ waiting, data = faithful)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.29917 -0.37689 0.03508 0.34909 1.19329
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.874016 0.160143 -11.70 <2e-16 ***
## waiting 0.075628 0.002219 34.09 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4965 on 270 degrees of freedom
## Multiple R-squared: 0.8115, Adjusted R-squared: 0.8108
## F-statistic: 1162 on 1 and 270 DF, p-value: < 2.2e-16
# Residuals : 잔차(오차)
# Coefficients : 회귀계수(Estimate)
# (Intercept) : 절편(상수) : -1.874016
# 독립변수 waiting 회귀계수는: 0.075628
# Pr(>|t|) 유의확률이다.
# 0.0000000000000002 < 유의수준 0.05
format(2e-16, scientific=FALSE)
## [1] "0.0000000000000002"
format(1.79e-07, scientific=FALSE)
## [1] "0.000000179"
data("pressure")
model2 <- lm(pressure ~ temperature, data = pressure)
summary(model2)
##
## Call:
## lm(formula = pressure ~ temperature, data = pressure)
##
## Residuals:
## Min 1Q Median 3Q Max
## -158.08 -117.06 -32.84 72.30 409.43
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -147.8989 66.5529 -2.222 0.040124 *
## temperature 1.5124 0.3158 4.788 0.000171 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 150.8 on 17 degrees of freedom
## Multiple R-squared: 0.5742, Adjusted R-squared: 0.5492
## F-statistic: 22.93 on 1 and 17 DF, p-value: 0.000171
# Residuals : 잔차(오차)
# Coefficients : 회귀계수(Estimate)
# (Intercept) : 절편(상수) : -147.8989
# 독립변수 temperature 회귀계수는: 1.5124
# Pr(>|t|) 유의확률이다.
# 0.000171 < 유의수준 0.05
# 귀무가설 : 회귀계수는 0이다.
# 대립가설 : 회귀계수는 0이 아니다.
# 따라서 귀무가설 기각, 통계적으로 유의한
# 변수라고 한다.
# Multiple R-squared: 0.5742, Adjusted
# R-squared: 0.5492
# 결정계수는 중간이므로 모델이 데이터에 대한
# 설명이 애매하다.
data("women")
model3 <- lm(weight ~ height, data = women)
summary(model3)
##
## Call:
## lm(formula = weight ~ height, data = women)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.7333 -1.1333 -0.3833 0.7417 3.1167
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -87.51667 5.93694 -14.74 1.71e-09 ***
## height 3.45000 0.09114 37.85 1.09e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.525 on 13 degrees of freedom
## Multiple R-squared: 0.991, Adjusted R-squared: 0.9903
## F-statistic: 1433 on 1 and 13 DF, p-value: 1.091e-14
# 0.0000000000000109 < 유의수준 0.05
# 귀무가설 : 회귀계수는 0이다.
# 대립가설 : 회귀계수는 0이 아니다.
# 따라서 귀무가설 기각, 통계적으로 유의한
# 변수라고 한다.
# Multiple R-squared: 0.991, Adjusted
# R-squared: 0.9903
# 결정계수는 1과 가까우므로 모델이 데이터를 잘
# 설명한다고 할 수 있다.