[R] Initialize varFunc in R

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Feb 24 16:49:22 CET 2009

Dear Tania,

Shouldn't that be varIdent(form = ~species.group) instead of
varIdent(form = ~1|species.group)?

Notice that this is untested as you did not provide a self-contained
example (as de posting guide asked you to do).



PS Next time try the mixed-models mailing list with questions about

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Namens Tania BrenesArguedas
Verzonden: dinsdag 24 februari 2009 16:23
Aan: r-help at r-project.org
Onderwerp: [R] Initialize varFunc in R


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?


R-help at r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

More information about the R-help mailing list