[R] Re: question regarding variance components
Federico Calboli
f.calboli at ucl.ac.uk
Wed Dec 3 13:55:19 CET 2003
Assuming you are measuring Y and you have factor A fixed and factor B
random, I would create a model like:
mod<-lme(Y ~ A, random=~1|B/A, mydata)
VarCorr(mod1)
the term "random=~1|B" tells the model that B is a random factor, adding
the "/A" to get "random =~1|B/A" tells the model you want the
interaction between the fixed and random factors.
VarCorr gives you the variance components of the model.
All is answered much better (and with examples) in Pinheiro and Bates
2000 (it's in the first chapter) and in Crawley 2002.
I have posted a question similar to yours times ago, and got an
excellent reply from Prof Bates; search the archives for it.
If ALL your factors are random try something:
mod<-lme(Y~1,random=~1|A/B, mydata)
VarCorr(mod)
but here I am more guessing than anything. Get Pinheiro and Bates 2000
for this.
Cheers,
Federico
--
=================================
Federico C. F. Calboli
PLEASE NOTE NEW ADDRESS
Dipartimento di Biologia
Via Selmi 3
40126 Bologna
Italy
tel (+39) 051 209 4187
fax (+39) 051 251 208
f.calboli at ucl.ac.uk
More information about the R-help
mailing list