[R] how to get Residual Standard Error

Douglas Bates bates at stat.wisc.edu
Fri Dec 13 22:16:12 CET 2002


"Zhongming Yang" <Zhongming.Yang at cchmc.org> writes:

> Hi,
> 
> I use lm or loess to make smoothing. After smoothing I need "Residual
> Standard Error" in my script. Could you please tell me how can I get
> this information?

A preferred way would be to use
 sqrt(deviance(fm)/df.residual(fm))
if fm is your fitted model. 

pFor example

> data(Formaldehyde)
> fm <- lm(optden ~ carb, data = Formaldehyde)
> summary(fm)

Call:
lm(formula = optden ~ carb, data = Formaldehyde)

Residuals:
        1         2         3         4         5         6 
-0.006714  0.001029  0.002771  0.007143  0.007514 -0.011743 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 0.005086   0.007834   0.649    0.552    
carb        0.876286   0.013535  64.744 3.41e-07 ***
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 

Residual standard error: 0.008649 on 4 degrees of freedom
Multiple R-Squared: 0.999,	Adjusted R-squared: 0.9988 
F-statistic:  4192 on 1 and 4 DF,  p-value: 3.409e-07 

> sqrt(deviance(fm)/df.residual(fm))
[1] 0.0086487




More information about the R-help mailing list