[R] GLS in R
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu Jul 10 18:25:11 CEST 2003
Simon Wood <simon at stats.gla.ac.uk> writes:
> > do I choleski decompose
> > the inverse of the covariance matrix and weight the observations -
> > risking precision loss.
> - I think you'd be better off choleski decomposing the cov matrix itself
> wouldn't you? e.g. if V is the covariance matrix use chol() to get
> V=L^T L
> and then form L^{-T}y and L^{-T}X using solve() (assuming model is
> y=Xb+e).
> Simon
If you supply a user-defined residual correlation structure to gls() I
think that's what you end up doing, and you have additional options
for modelling variance structure and you can estimate parameters
for either of them.
gls() is in library(nlme) and included with the system by default.
Writing user-supplied correlation structures is quite possible but
somewhat involved since you need to write out about eight methods for
each structure (apropos("corCAR1") should give you an idea of what it
takes). Unfortunately, the examples of how to do this at the R level
seem to have been optimized out of existence; all of that stuff is in
.C calls now.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list