Skip to content
Prev 1174 / 20628 Next

Generalized least squares program

Hi Gang,

Sorry, I should have said "update()" instead
of "predict()".

However, a timing test on a small example shows no
considerable gain to updating an existing object
compared to refitting a new object.  This may be different
for your scenario.  If not, then it's an exercise of
diving into the code base to figure out how to adapt
the update.gls() function or related fitting
functions so you can run your extra fits without
recomputing everything.
+            correlation = corAR1(form = ~ 1 | Mare))
+            correlation = corAR1(form = ~ 1 | Mare))
[1] TRUE
+             for(i in 1:100) {
+               fm2 <- update(fm1, model. = jitterFollicles ~ .)
+             }
+             )
   user  system elapsed 
 12.022   5.238  17.264
+             for(i in 1:100) {
+               fm3 <-  gls(jitterFollicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary,
+                           correlation = corAR1(form = ~ 1 | Mare))
+             }
+             )
   user  system elapsed 
 11.898   5.227  17.126
Steve McKinney


-----Original Message-----
From: Gang Chen [mailto:gangchen at mail.nih.gov]
Sent: Wed 7/16/2008 11:34 AM
To: Steven McKinney
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] Generalized least squares program
 
Thanks for the suggestion!

It seems to me predict() is the opposite of what I'm looking for.  
With an extended linear model

Y = X*b + e, e ~ N(0, R s^2), R s^2 is the  covariance matrix of the  
residual term e

both X and the structure of R remain the same across all the loops in  
my case, and Y is different and so are the estimates of b and R s^2  
from one iteration to another.

Gang
On Jul 16, 2008, at 1:29 PM, Steven McKinney wrote: