[R] How to conctruct an inner grouping for nlme random statement?
JJ
josh8912 at yahoo.com
Wed Feb 23 07:05:21 CET 2005
Hello. Im hoping someone can help with a grouping
question related to the "random=" statement within the
nlme function. How do you specify that some grouping
levels are inner to others? I tried several things,
given below.
Lets say I have a data frame with five variables,
resp, cov1, ran1, ran2, group1, and group 2. The
formula is resp~cov1 + ran1 + ran2, where the ran are
random variables. The data is of length 80, and there
are 4 unique factors in group1 and 20 unique factors
in group2. These are factors related to ran1 and
ran2, respectively.
The difficult part is that I want to estimate only 4
random variables for ran1|group1 and the full 20 for
ran2|group2. I have tried many ways, and I cannot
find a way to do this. Is there a way? Can someone
suggest a code snippet?
First I tried making the data frame a groupedData
object, so that group2 is inner to group1, as it
should be. Then I used the statement: random =
as.formula(ran1+ran2~1). But this produced 20
estimates for both ran1 and ran2.
I have also tried it without the data frame as a
groupedData object, using the following:
random = list(group1= c(ran1~1, group2=ran2~1)). But
this gave only 4 estimates for ran2. I also tried:
random = list(c(group1= ran1~1, group2=ran2~1)), but
this just gave a parse error message.
Any suggestions would be greatly appreciated. Is it
even possible to do what I want to do? John
More information about the R-help
mailing list