[R] Initialize varFunc in R

Tania BrenesArguedas taniabrenes at gmail.com
Tue Feb 24 16:23:14 CET 2009


Hi,

I am running R2.8.1 under Linux, and I am having trouble using the
variance functions in nlme

My basic model was something like:

model0 <- lme( log(growth) ~ light * species.group , data=data,
random=~light|species  )   # with 20 odd species divided in 2 groups

Following the methods in Pinheiro&Bates I tried to put a variance
function in the model:

model1 <- update(model0, weights=varIdent(form = ~1|species.group) )

I got no error message or note but when I printed model1 the output
did not print any variance structure. It just didn't add any weights
or variance structure and model1 = model0

If instead I ran the varFunc sepparately:

varf1 <- varIdent(form = ~1|species.group)
varf.init <- Initialize(varf1, data)
model1 <- update(model0, weights=varf.init )

it works just fine, and I get an output with "Variance function:
Structure: Different standard deviations per stratum" and a change in
the diagnostic plots. So, this one works

Digging a little bit I noticed that the "initialize" in Pinheiro&Bates
is not capitalized. And "initialize" in R is used by some other
package, such that each time I would try to follow the book I would
get an error message:
" c("\"varIdent\" is not a defined class", "\"varFunc\" is not a
defined class")"

When I figured out that in R I had to use "Initialize" with uppercase,
I was able to make the above work.

Is this an bug with the R varFunc or am I doing something wrong?

Tania




More information about the R-help mailing list