Question upfront: If use summary
, I get a much more detailed view on my model than just print
produces. In R, how can I know what extra information my object holds, such as revealed by summary
, which I would not see without the knowledge of that generic function? Put in other words, how do I know what functions are available that yield additional information?
I conduct a quick linear least squares regression with:
model <- lm(seq(10) + runif(10) ~ seq(10))
Now, when I print the model, I get:
print(model)
Call:
lm(formula = seq(10) + runif(10) ~ seq(10))
Coefficients:
(Intercept) seq(10)
0.3642 1.0413
Instead, when I use summary(model)
, I get a much more detailed view. Why wouldn't I obtain that in the first place?
> summary(model)
Call:
lm(formula = seq(10) + runif(10) ~ seq(10))
Residuals:
Min 1Q Median 3Q Max
-0.42297 -0.20032 0.00175 0.18183 0.39827
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.36419 0.18980 1.919 0.0913 .
seq(10) 1.04133 0.03059 34.043 6.06e-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2778 on 8 degrees of freedom
Multiple R-squared: 0.9931, Adjusted R-squared: 0.9923
F-statistic: 1159 on 1 and 8 DF, p-value: 6.057e-10