[R] Change in 'solve' for r-patched

Ole F. Christensen olefc at daimi.au.dk
Fri Oct 31 17:36:08 CET 2003


Dear R help

Thanks to Professor Bates for his information about how to calculate 
least square estimates [not using solve] in ``the right way''.
This is very useful indead, I am clearly one of of the package 
maintainers who is not using using solve in a proper way at the moment.
However, the calculations in my code look more like GLS than LS.

## GLS could in principlpe be implemented like this :
betahat <- solve(t(X) %*% solve(Omega)%*% X) %*% t(X)%*%solve(Omega)%*% y
## where Omega is a strictly p.d. symmetric matrix

Does someone have a recommendation on how to do this in ``the right way'' ?

My first attempt (trying to imitate the LS solution recommended by Prof. Bates) is :

temp <- backsolve(chol(Omega),cbind(X,y))
betahat <- qr.coef(qr(temp[,1:ncol(X)]), temp[,ncol(X)+1])



Thank you in advance for any help


Cheers Ole

-- 
Ole F. Christensen
Center for Bioinformatik
Datalogisk Institut
Aarhus Universitet
Ny Munkegade, Bygning 540
8000 Aarhus C
Denmark




More information about the R-help mailing list