모델 피팅의 결과를 model1 객체에 저장하자. 이렇게 찾은 모델은 간단히 model1을 입력하거나 print(model1)을 입력하여 출력할 수 있다.
> model1
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
2.051 2.973
더 자세한 내용을 알고 싶다면 model1에 대해 summary() 함수를 사용하자.
> summary(model1)
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-0.88242 -0.31700 -0.08221 0.25683 1.14234
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.00448 0.04723 42.45 <2e-16 ***
x 3.00067 0.04687 64.02 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4721 on 98 degrees of freedom
Multiple R-squared: 0.9767, Adjusted R-squared: 0.9764
F-statistic: 4099 on 1 and 98 DF, p-value: < 2.2e-16