[R] ls.diag and lsfit very basic question

P Ehlers ehlers at ucalgary.ca
Sun Jan 23 15:26:47 CET 2011


MM wrote:
> Hello,
> 
> Is the "std.dev" component of ls.diag( lsfit(x,y) ) the sample standard
> deviation of the residuals of the fit?
> 
> I have
>   ls.diag(lsfit(xx,yy))$std.dev
> different from
>   sd(lsfit(xx,yy)$residuals)
> 
> where xx and yy are vectors of 5 elements.

Compare

     ls.diag(lsfit(xx,yy))$std.dev

with

     sd(resid(lsfit(xx,yy)))*sqrt(4/3)

and think about degrees of freedom.

Peter Ehlers

> 
> Regards,
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list