Skip to content
Prev 16381 / 20628 Next

[FORGED] Re: Question about gls --- whoops!!!

On 24/03/18 10:52, Rolf Turner wrote:
Nope!  ***NOT*** bingo!!!  Louise just pointed out to me that what I got 
by applying as.vector(), i.e. 0.3533897, is not the same as the number 
one gets by just typing fit.gls$modelStruct$corStruct, which is 
0.1748786 --- which is what Andrzej's approach gives (and which would
appear to be the right answer).  Bit of a duhhh on my part.

Setting unconstrained=FALSE as in Andrzej's approach seems to be 
crucial.  I missed that bit ....

But it still mystifies me why as.vector() doesn't give the same numeric 
value as is obtained from just printing the object in question.  Also
looking at the code of nlme:::coef.corStruct I would have thought that
this function would simply throw an error when unconstrained is set to 
FALSE.  (Just type "nlme:::coef.corStruct" and you'll see what I mean.)

If I set foo <- nlme:::coef.corStruct and then do

     foo(fit.gls$modelStruct$corStruct)

I do indeed get an error.  WTF?

There would appear to be no way for the results to be different (look
at the code) --- but different they are.

But that sort of nonsense is to be expected when S4 classes and methods 
are involved in any way.

cheers,

Rolf