calculate p-value for an interaction term at a specific time point from the results of an lme model in R

61 Views Asked by At

I am running a linear mixed model on a longitudinal dataset.

How do I go about calculating a p-value for the interaction term 'trt*Category' at time = 2 (years)? In other words, I need the overall interaction p-value for 'trt * Category' when time = 2 years, irrespective of the values of trt and Category.

In the dataset df_new -

  1. base is a continuous variable, with longitudinal values at different time points
  2. base0 is a continuous variable at time=0 (baseline value)
  3. trt variable has 2 values: 0 and 1 with 0 as the reference level
  4. Category has 3 levels: A, B, C with A as the reference level
  5. time (in years) has 4 values: 0.1, 0.5, 1, 2
  6. time2 is just a quadratic term for time variable
  7. ID is the subject ID

Model has -

  1. 2-way interactions and one 3-way interaction
  2. intercept and time as random effects

Any help is appreciated.

> lmeFit.check <- lme(base ~ base0 + trt + Category + time + time2 + time:trt + time2:trt + time:Category + time2:Category + trt:Category+ time*trt*Category, data = df_new, random = ~ time| ID, na.action=na.exclude, method="ML")

> summary(lmeFit.check)
Linear mixed-effects model fit by maximum likelihood
  Data: df_new 
        AIC       BIC   logLik
  -1239.015 -1123.239 640.5077

Random effects:
 Formula: ~time | ID
 Structure: General positive-definite, Log-Cholesky parametrization
            StdDev     Corr  
(Intercept) 0.1370508 (Intr)
Time        0.0861213 -0.021
Residual    0.1245289 

                           Value  Std.Error   DF   t-value p-value
(Intercept)            0.3342470 0.02907089 1228 11.497651  0.0000
base0                  0.4862522 0.03065282  587 15.863210  0.0000
trt1                   0.1581257 0.02858652  587  5.531477  0.0000
CategoryC             -0.1561378 0.03683512  587 -4.238831  0.0000
CategoryB             -0.0444300 0.02586699  587 -1.717634  0.0864
time                   0.0048867 0.03813285 1228  0.128149  0.8981
time2                 -0.0109739 0.01765595 1228 -0.621542  0.5344
trt1:time             -0.0568882 0.03974451 1228 -1.431346  0.1526
trt1:time2             0.0205837 0.01633965 1228  1.259738  0.2080
CategoryC:time         0.1909650 0.06328872 1228  3.017362  0.0026
CategoryB:time         0.0648119 0.04091624 1228  1.584015  0.1134
CategoryC:time2       -0.0770699 0.02972717 1228 -2.592574  0.0096
CategoryB:time2       -0.0292700 0.01824750 1228 -1.604052  0.1090
trt1:CategoryC         0.1007911 0.05053169  587  1.994612  0.0465
trt1:CategoryB        -0.0226765 0.03330770  587 -0.680819  0.4963
trt1:CategoryC:time   -0.0526821 0.05042956 1228 -1.044668  0.2964
trt1:CategoryB:time    0.0196245 0.03078963 1228  0.637375  0.5240

I believe this can be accomplished using the contrast option? But, need some helpful pointers...

0

There are 0 best solutions below