Reputation: 1
I am running a latent class growth model using hlme from the lcmm package in R. See code below:
gridsearch(rep = 100, maxiter = 10, minit = lcga1_c,
m=hlme(cHairCortisolConclog~Visit+I(Visit^2)+I(Visit^3), subject = "ID", ng = 3,
data = data_long, mixture = ~ Visit+I(Visit^2)+I(Visit^3)))
I have determined that my outcome follows a cubic trajectory over time in some of my latent classes, so I have included a cubic term for my time variable (Visit) in the model. The cubic term is significant in 2 out of the 3 classes that were identified. See output below:
Fixed effects in the longitudinal model:
coef Se Wald p-value
intercept class1 -2.87572 2.32800 -1.235 0.21673
intercept class2 1.61864 0.52613 3.077 0.00209
intercept class3 2.34416 0.49703 4.716 0.00000
Visit class1 4.00429 2.80767 1.426 0.15381
Visit class2 1.30048 0.70896 1.834 0.06660
Visit class3 1.46184 0.64264 2.275 0.02292
I(Visit^2) class1 -1.34900 1.01259 -1.332 0.18279
I(Visit^2) class2 -0.76651 0.27105 -2.828 0.00469
I(Visit^2) class3 -0.75885 0.24353 -3.116 0.00183
I(Visit^3) class1 0.14569 0.11131 1.309 0.19060
I(Visit^3) class2 0.09950 0.03055 3.257 0.00112
I(Visit^3) class3 0.09487 0.02730 3.475 0.00051
I have seen other papers remove non-significant higher order terms from classes where they were not significant, which I would like to do as well. Specifically, I want to remove the cubic and quadratic Visit terms from Class 1 only, since they are non-significant. How do I do this? I know this is possible in SAS using PROC TRAJ and the ORDER= statement, but I don't know how to do this this in the lcmm package.
I haven't been able to figure out how to drop these terms from the model. Ideally, I would want the output to look like this (but the model would be re-estimated without those terms in the model):
Fixed effects in the longitudinal model:
coef Se Wald p-value
intercept class1 -2.87572 2.32800 -1.235 0.21673
intercept class2 1.61864 0.52613 3.077 0.00209
intercept class3 2.34416 0.49703 4.716 0.00000
Visit class1 4.00429 2.80767 1.426 0.15381
Visit class2 1.30048 0.70896 1.834 0.06660
Visit class3 1.46184 0.64264 2.275 0.02292
I(Visit^2) class2 -0.76651 0.27105 -2.828 0.00469
I(Visit^2) class3 -0.75885 0.24353 -3.116 0.00183
I(Visit^3) class2 0.09950 0.03055 3.257 0.00112
I(Visit^3) class3 0.09487 0.02730 3.475 0.00051
Upvotes: 0
Views: 41
Reputation: 1
You can fix parameters to zero by using the posfix
argument. As noted in the documentation of hlme
:
posfix: Optional vector specifying the indices in vector B of the parameters that should not be estimated. Default to NULL, all parameters are estimated.
Upvotes: 0