[R] ls.diag and lsfit very basic question
Joshua Wiley
jwiley.psych at gmail.com
Sun Jan 23 02:21:11 CET 2011
Hi,
Yes, that is basically the idea. It is defined as:
stddev <- (colSums(as.matrix(resids^2))/(n - p))^0.5
Where n is the number of rows in the residual matrix and p is the rank
of the QR decomposition. I believe the reason they are slightly
different is that the mean of the residuals is not necessarily exactly
0.
Cheers,
Josh
On Sat, Jan 22, 2011 at 2:54 PM, MM <finjulhich at gmail.com> 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.
>
> 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.
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/
More information about the R-help
mailing list