Clark Kogan
2012-Aug-14 18:11 UTC
[R] Specifying unique random effects for different groups
Hello, I have a longitudinal dataset with a number of subjects that were subjected to various sleep deprivation schedules. The data is grouped by individual, and the individuals are grouped by sleep schedule. I have fit a nonlinear mixed effects model to this dataset using the command: nlme(y ~ mymodel(time,schedulenumber,list(a=a,b=b)), data=mysleepdata,fixed=a+b+c~1,random=a+b~1, start=c(a=1.0, b=0.7,c=0.2)) There are 5 different sleep schedules (1,2,3,4,5), however, I would like the parameter "b" to be a random effect for only schedules 2-5. The reason for this, is that the parameter "b" has no effect on the model for schedule 1, and it seems that it is causing oscillations (or ping ponging) in the algorithm, and convergence is never achieved (unless I change the tolerance to 1e-1, which I am not sure that I want to do.) How would I modify the above code so that the first 13 individuals, or those with schedulenumber=1 do not have the random effect "b"? Thanks!! Clark Kogan