Dear list:
I am trying to merge two files together from output I get based on the coef()
command. Here is what I am running into.
I have two simple linear mixed models
> mod1.lme<-lme(math~year, data=sample, random=~year|childid/schoolid)
> mod2.lme<-lme(math~year, data=sample, random=~year|childid)
I then call the coefficients and store them in the following objects using
> mod1.coef<-coef(mod1.lme, level=2)
> mod2.coef<-coef(mod2.lme)
The problem is that the IDs are different for the two dataframes and I cannot
seem to figure out how to make the merge happen nicely. For example, this is
output from mod1.lme for the first 5 students
> mod1.coef[1:5,]
(Intercept) year
2020 /273026452 0.03923346 0.9575926
2020 /273030991 0.91772318 1.0773731
2020 /273059461 0.43865139 1.0111789
2020 /278058841 1.11292376 1.0526057
2020 /292017571 1.09661340 1.0774692
As opposed to out for the first 5 cases in mod2.coef
> mod2.coef
(Intercept) year
101480302 -1.13483082 0.7023644
173559292 0.52818576 0.8639216
174743401 -1.18038537 0.6824612
174755092 0.04760782 0.7402835
179986251 -2.42848405 0.5677182
You can see that the ID variable for the first output includes the grouping
variable "schoolid" followed by a "/" and then the
"childid".
I am interested in exploring the differences in the growth trajectories between
the two models and would like to merge the two datasets to be able to do so.
What do I need to do to somehow eliminate the schoolid and "/" from
mod1.lme so that I can use the merge() command?
Thanks,
Harold C. Doran
Director of Assessment
One Massachusetts Avenue, NW ยท Suite 700
Washington, DC 20001-1431
202.336.7075
[[alternative HTML version deleted]]