I'm not sure the idea of having a generic 'sd' extract the residual standard deviation from a linear model quite jives with me. Personally, I think a generic function with name like 'residSD' or something similar would be better.
Either way, I think it would be nice to have some function like this. -roger Rolf Turner wrote: > I have from time to time seen inquiries on r-help in respect of > how to obtain the estimated standard deviation from the output of > fitting a linear model. And have had occasion to want to do this > myself. > > The way I currently do it is something like summary(fit)$sigma > (where fit is returned by lm()). > > It strikes me that it might be a good idea to have an extractor > function, analogous with coef() and resid(), to dig out this value. > This would be in keeping with the R philosophy of ``don't muck > about with the internal components of objects returned by functions, > because the internal structure of such objects might change in future > releases''. > > I'm not sure what the name of the extractor function should be. > One idea would be to make sd() generic, and create a function > sd.lm() which could currently have code > > sd.lm <- function(x,...) { > summary(x)$sigma > } > > The sd.default() function would have the code of the current sd(). > > Does this idea have any merit? > > cheers, > > Rolf Turner > > ###################################################################### > Attention:\ This e-mail message is privileged and confid...{{dropped:9}} > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- Roger D. Peng | http://www.biostat.jhsph.edu/~rpeng/ ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel