This vignette illustrates how to estimate a longitudinal IRT following the methodology described in Proust-Lima et al. (2021 - https://arxiv.org/abs/2109.13064). The model combines a graded response measurement model to link a series of ordinal items measured repeatedly over time with their underlying latent process. Simultaneously, a linear mixed model describes the trajectory of the underlying latent process over time.
The longitudinal IRT model is estimated via multlcmm function of lcmm R package (Proust-Lima et al. 2017). The following libraries are used in this vignette:
The illustration is on a simulated dataset that mimics the PREDIALA study described and analyzed in Proust-Lima et al. (2021). The dataset is called simdataIRT. It contains the following information:
str(simdataHADS)
#> 'data.frame': 1140 obs. of 13 variables:
#> $ grp : int 1 0 0 0 0 0 1 0 0 0 ...
#> $ sex : int 1 0 0 0 0 0 1 1 1 1 ...
#> $ age : num 59.5 58.2 58.2 58.2 58.2 ...
#> $ hads_2 : int 0 3 1 1 1 2 2 3 3 2 ...
#> $ hads_4 : int 0 0 0 1 0 1 3 2 2 2 ...
#> $ hads_6 : int 0 0 1 1 0 1 1 1 2 2 ...
#> $ hads_8 : int 1 0 1 0 1 1 1 2 1 2 ...
#> $ hads_10 : int 0 0 2 0 0 1 1 3 1 2 ...
#> $ hads_12 : int 0 0 0 0 0 1 2 3 3 2 ...
#> $ hads_14 : int 0 0 0 0 0 0 0 0 0 1 ...
#> $ ID : int 1 2 2 2 2 2 3 4 4 4 ...
#> $ time : num 7.74 3.18 8.95 15.08 19.74 ...
#> $ time_entry: num 7.74 3.18 3.18 3.18 3.18 ...
demo <- simdataHADS %>% group_by(ID) %>% arrange(time) %>%
filter(row_number()==1)
summary(demo)
#> grp sex age hads_2
#> Min. :0.0000 Min. :0.0000 Min. :55.92 Min. :0.0000
#> 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:58.28 1st Qu.:0.0000
#> Median :1.0000 Median :1.0000 Median :59.00 Median :1.0000
#> Mean :0.5722 Mean :0.5954 Mean :58.99 Mean :0.8806
#> 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:59.62 3rd Qu.:1.0000
#> Max. :1.0000 Max. :1.0000 Max. :61.96 Max. :3.0000
#> hads_4 hads_6 hads_8 hads_10
#> Min. :0.0000 Min. :0.0000 Min. :0.000 Min. :0.0000
#> 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:1.000 1st Qu.:0.0000
#> Median :0.0000 Median :1.0000 Median :1.000 Median :0.0000
#> Mean :0.6613 Mean :0.6827 Mean :1.219 Mean :0.6292
#> 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:2.000 3rd Qu.:1.0000
#> Max. :3.0000 Max. :3.0000 Max. :3.000 Max. :3.0000
#> hads_12 hads_14 ID time
#> Min. :0.0000 Min. :0.0000 Min. : 1 Min. : 0.06557
#> 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:141 1st Qu.: 2.65574
#> Median :0.0000 Median :0.0000 Median :281 Median : 5.14754
#> Mean :0.6898 Mean :0.3012 Mean :281 Mean : 8.24991
#> 3rd Qu.:1.0000 3rd Qu.:0.0000 3rd Qu.:421 3rd Qu.:11.04918
#> Max. :3.0000 Max. :3.0000 Max. :561 Max. :43.14754
#> time_entry
#> Min. : 0.06557
#> 1st Qu.: 2.65574
#> Median : 5.14754
#> Mean : 8.24991
#> 3rd Qu.:11.04918
#> Max. :43.14754
The timescale of interest is the time in months spent on the waiting list: time. This timescale poses two problems:
As in many studies, entry in the study occurs for each individual at different timings in the progression of the disease. this is called delayed entry. It differs from the usual time in the study where entry corresponds to time 0. Here entry (variable time_entry) corresponds to the duration on the waiting list at inclusion, and time 0 is unlikely observed (i.e., entry in the cohort does not occur as the same time as entry on waiting list).
The timescale is continuous per se, with as many values as the number of total observations. This prevents the use of methods considering discrete timescales with measurements at the same times for all the individuals, such as classical longitudinal latent variable models.
Distribution of the time at entry and time at follow_ups
tempSim <- simdataHADS %>% group_by(ID) %>% arrange(time) %>% mutate(Visit=ifelse(time==time_entry,"Entry","Follow-up"))
p <- ggplot(tempSim, aes(x=time,fill=Visit,color=Visit)) + geom_histogram(binwidth=1,aes(y=..density..)) +
labs(x="Months on the waiting list")
p + scale_color_grey(start = 0.1,
end = 0.5)+scale_fill_grey(start = 0.1,
end = 0.5) +
theme_classic()
Quantiles of the distribution of measurement times
We consider here a longitudinal IRT model with natural cubic splines on time on the waiting list to account for a possible nonlinear trajectory over time, and we adjust the trajectory for the group. We consider 2 internal knots placed at 7 and 15, and shift the right boundary at 60 due to the long tail of the distribution. In the main analysis, we estimate a model with no differential item functioning (DIF) on the group and no response shift (RS) on time.
To reduce the computation time, we first estimate a model with only 1 random-effect, a random intercept. And then, we use the estimates as initial values for the estimation of the model that also includes random-effects on the time functions. Estimation involves a numerical integration approximated by quasi Monte-Carlo (QMC) with 1000 points. This induces very intensive and long computations but was shown to give accurate results in simulations.
modIRT_i <- multlcmm(hads_2 + hads_4 +hads_6 + hads_8 +hads_10+hads_12 + hads_14 ~ ns(time,knots=c(7,15),Boundary.knots = c(0,60))*grp,random=~1,data=simdataHADS,subject="ID",link="thresholds",methInteg="QMC",nMC=1000)
# use the estimates as initial values - the vector c(0,1,0,0,1,0,0,0,1) initializes the cholesky matrix of the random-effects
Binit <- c(modIRT_i$best[1:7],c(0,1,0,0,1,0,0,0,1),modIRT_i$best[8:length(modIRT_i$best)])
modIRT <- multlcmm(hads_2 + hads_4 +hads_6 + hads_8 +hads_10+hads_12 + hads_14 ~ ns(time,knots=c(7,15),Boundary.knots = c(0,60))*grp,random=~1+ns(time,knots=c(7,15),Boundary.knots = c(0,60)),data=simdataHADS,subject="ID",link="thresholds",methInteg="QMC",nMC=1000, B=Binit)
The summary of the estimation:
summary(modIRT)
#> General latent class mixed model
#> fitted by maximum likelihood method
#>
#> multlcmm(fixed = hads_2 + hads_4 + hads_6 + hads_8 + hads_10 +
#> hads_12 + hads_14 ~ ns(time, knots = c(7, 15), Boundary.knots = c(0,
#> 60)) * grp, random = ~1 + ns(time, knots = c(7, 15), Boundary.knots = c(0,
#> 60)), subject = "ID", link = "thresholds", data = simdataHADS,
#> methInteg = "QMC", nMC = 1000)
#>
#> Statistical Model:
#> Dataset: simdataHADS
#> Number of subjects: 561
#> Number of observations: 7980
#> Number of latent classes: 1
#> Number of parameters: 44
#> Link functions: Thresholds for hads_2
#> Thresholds for hads_4
#> Thresholds for hads_6
#> Thresholds for hads_8
#> Thresholds for hads_10
#> Thresholds for hads_12
#> Thresholds for hads_14
#>
#> Iteration process:
#> Convergence criteria satisfied
#> Number of iterations: 30
#> Convergence criteria: parameters= 2e-08
#> : likelihood= 3.2e-06
#> : second derivatives= 1.8e-06
#>
#> Goodness-of-fit statistics:
#> maximum log-likelihood: -7218.96
#> AIC: 14525.91
#> BIC: 14716.42
#>
#> Maximum Likelihood Estimates:
#>
#> Fixed effects in the longitudinal model:
#>
#> coef Se
#> intercept (not estimated) 0.00000
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.13037 0.14971
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.20745 0.35059
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.55413 0.20665
#> grp -0.60195 0.19524
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1:grp 0.23105 0.20314
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2:grp 0.46499 0.44974
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3:grp -0.06219 0.32068
#> Wald p-value
#> intercept (not estimated)
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.871 0.38387
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.592 0.55404
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 2.681 0.00733
#> grp -3.083 0.00205
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1:grp 1.137 0.25537
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2:grp 1.034 0.30118
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3:grp -0.194 0.84622
#>
#>
#> Variance-covariance matrix of the random-effects:
#> (the variance of the first random effect is not estimated)
#> intercept
#> intercept 1.00000
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.34385
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 -1.00748
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 -0.09015
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 0.65616
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.79507
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.40139
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 2.13117
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.30796
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.2747
#>
#> hads_2 hads_4 hads_6 hads_8 hads_10 hads_12
#> Residual standard error: 0.78685 0.63468 1.03439 1.01073 1.05546 0.67910
#> hads_14
#> Residual standard error: 1.63853
#>
#> Parameters of the link functions:
#>
#> coef Se Wald p-value
#> hads_2-Thresh1 -0.54296 0.16481 -3.294 0.00099
#> hads_2-Thresh2 1.12581 0.05349 21.046 0.00000
#> hads_2-Thresh3 0.88949 0.05032 17.678 0.00000
#> hads_4-Thresh1 -0.23896 0.15916 -1.501 0.13325
#> hads_4-Thresh2 1.01287 0.04844 20.909 0.00000
#> hads_4-Thresh3 1.04562 0.05856 17.856 0.00000
#> hads_6-Thresh1 -0.38855 0.16408 -2.368 0.01788
#> hads_6-Thresh2 1.35285 0.06836 19.790 0.00000
#> hads_6-Thresh3 1.32439 0.09443 14.025 0.00000
#> hads_8-Thresh1 -1.39105 0.20071 -6.931 0.00000
#> hads_8-Thresh2 1.34308 0.06446 20.836 0.00000
#> hads_8-Thresh3 1.10197 0.05825 18.918 0.00000
#> hads_10-Thresh1 -0.02481 0.16367 -0.152 0.87949
#> hads_10-Thresh2 1.00550 0.05464 18.403 0.00000
#> hads_10-Thresh3 1.10645 0.06561 16.863 0.00000
#> hads_12-Thresh1 -0.20523 0.15916 -1.289 0.19724
#> hads_12-Thresh2 0.99398 0.04808 20.675 0.00000
#> hads_12-Thresh3 1.02543 0.05776 17.753 0.00000
#> hads_14-Thresh1 0.91742 0.20988 4.371 0.00001
#> hads_14-Thresh2 1.49255 0.09869 15.124 0.00000
#> hads_14-Thresh3 0.87180 0.10143 8.595 0.00000
The predicted trajectory of the underlying process can be obtained with predictL function and the associated plot function.
datnew <- data.frame(time = seq(0,75,by=1))
datnew$grp <- 0
pIRT0 <- predictL(modIRT,datnew,var.time="time",confint = T)
datnew$grp <- 1
pIRT1 <- predictL(modIRT,datnew,var.time="time",confint = T)
plot(pIRT0,col=1,lwd=2,ylim=c(-1.5,1.5),legend=NULL,main="",ylab="latent depressive symptomatology",xlab="months since entry on the waiting list",type="l",bty="l",shades=T)
plot(pIRT1,add=T,col=4,lwd=2,shades=T)
legend(x="topleft",legend=c("dialysed","preemptive"),lty=c(1,1),col=c(1,4),lwd=2,bty="n")
To better appreciate the range of the underlying depressive symptomatology, the empirical posterior distribution can be computed
beta <- modIRT$best
t <- 0:72
Z <- cbind(rep(1,length(t)),ns(t,knots=c(7,15),Boundary.knots = c(0,60)))
chol <- matrix(0,ncol=4,nrow=4)
chol[upper.tri(chol, diag = T)] <- c(1,beta[7:15])
library(mvtnorm)
Lambda0 <- rmvnorm(10000,mean = Z%*%c(0,beta[1:3]),Z%*%t(chol)%*%chol%*%t(Z))
Lambda1 <- rmvnorm(10000,mean = Z%*%beta[4:7],Z%*%t(chol)%*%chol%*%t(Z))
Lambda <- data.frame(Lambda = as.vector(rbind(Lambda0,Lambda1)))
phist <- ggplot(Lambda,aes(x=Lambda))+ geom_density(color="grey", fill="grey") + theme_bw() +
xlab("underlying depressive symptomatology") +xlim(-7,7)
phist
Warning: Removed 14464 rows containing non-finite values (stat_density).
The 95% range of the underlying distribution is approximately:
The location and discrimination parameters are transformations of the estimated parameters. They are retrieved with the following code:
## Parameters
nlevel <- 4
nitems <- 7
levels <- rep(nlevel,nitems)
npm <- length(modIRT$best)
seuils <- modIRT$best[(npm-(nlevel-1)*(nitems)+1):(npm)]
err <- abs(modIRT$best[(npm-(nlevel-1)*(nitems)-(nitems-1)):(npm-(nlevel-1)*(nitems))])
seuils
#> Thresh1 Thresh2 Thresh3 Thresh1 Thresh2 Thresh3
#> -0.54295998 1.12581248 0.88948647 -0.23896189 1.01286765 1.04561833
#> Thresh1 Thresh2 Thresh3 Thresh1 Thresh2 Thresh3
#> -0.38854575 1.35284533 1.32439060 -1.39104501 1.34308298 1.10196668
#> Thresh1 Thresh2 Thresh3 Thresh1 Thresh2 Thresh3
#> -0.02481498 1.00550201 1.10644595 -0.20523446 0.99397714 1.02543122
#> Thresh1 Thresh2 Thresh3
#> 0.91741673 1.49254985 0.87180230
err
#> std.err 1 std.err 2 std.err 3 std.err 4 std.err 5 std.err 6 std.err 7
#> 0.7868467 0.6346774 1.0343869 1.0107349 1.0554643 0.6790975 1.6385266
# Variance
Vseuils <- VarCov(modIRT)[(npm-(nlevel-1)*(nitems)+1):(npm),(npm-(nlevel-1)*(nitems)+1):(npm)]
Verr <- VarCov(modIRT)[(npm-(nlevel-1)*(nitems)-(nitems-1)):(npm-(nlevel-1)*(nitems)),(npm-(nlevel-1)*(nitems)-(nitems-1)):(npm-(nlevel-1)*(nitems))]
# generic function
location <- function(min,max,param,Vparam){
loc <- param[1]
se <- sqrt(Vparam[1,1])
param2 <- rep(0,length(param))
param2[1] <- 1
if ((max-min)>1) {
for (l in 1:(max-min-1)) {
param2[l+1] <- 2*param[l+1]
loc[l+1] <- loc[l] + param[1+l]^2
se[l+1] <- sqrt(t(param2) %*%Vparam %*%param2)
}
}
return(c(loc,se))
}
# application
ItemLoc <- sapply(1:nitems,function(k){location(min=0,max=nlevel-1,param=seuils[((nlevel-1)*(k-1)+1):((nlevel-1)*k)],Vparam=Vseuils[((nlevel-1)*(k-1)+1):((nlevel-1)*k),((nlevel-1)*(k-1)+1):((nlevel-1)*k)])})
colnames(ItemLoc) <- paste("Item",(1:nitems)*2)
ItemLoc <- ItemLoc[c(1,4,2,5,3,6),]
rownames(ItemLoc) <- rep(c("Threshold","SE"),nlevel-1)
discrimination <- 1/abs(err)
sediscr <- diag(err^(-2))%*%Verr%*%diag(err^(-2))
The 3 thresholds and discrimination estimates of each item are:
t(rbind(ItemLoc,discrimination,Se=sqrt(diag(sediscr))))
#> Threshold SE Threshold SE Threshold SE
#> Item 2 -0.54295998 0.1648116 0.7244938 0.1761869 1.515680 0.2184180
#> Item 4 -0.23896189 0.1591583 0.7869390 0.1767165 1.880257 0.2422033
#> Item 6 -0.38854575 0.1640761 1.4416447 0.2220543 3.195655 0.3954593
#> Item 8 -1.39104501 0.2007092 0.4128269 0.1685202 1.627157 0.2307004
#> Item 10 -0.02481498 0.1636731 0.9862193 0.1968426 2.210442 0.2870308
#> Item 12 -0.20523446 0.1591645 0.7827561 0.1782252 1.834265 0.2411234
#> Item 14 0.91741673 0.2098824 3.1451218 0.4376183 3.905161 0.5382206
#> discrimination Se
#> Item 2 1.2708956 0.12409358
#> Item 4 1.5756036 0.15681998
#> Item 6 0.9667562 0.10083591
#> Item 8 0.9893791 0.09850672
#> Item 10 0.9474504 0.10031786
#> Item 12 1.4725427 0.14449255
#> Item 14 0.6103044 0.07789280
The curve of each item category probability according to the underlying level of depressive symptomatology can be obtain usinf the ItemInfo function.
## computations
info_modIRT <- ItemInfo(modIRT, lprocess=seq(-6,6,0.1))
meaning <- c("Enjoy","Laugh","Cheerful" ,"Slow" ,"Appearance" ,"Looking Forward" ,"Leisure")
items <- paste("hads", seq(2,14,2), sep="_")
## automatic graph
par(mfrow=c(2,4), mar=c(3,2,2,1), mgp=c(2,0.5,0))
for(k in 1:7)
{
plot(info_modIRT, which="LevelProb", outcome=items[k],
main=paste("Item",2*k,"-",meaning[k]), lwd=2, legend=NULL)
}
plot(0,axes=FALSE, xlab="", ylab="", col="white")
legend("center", legend=paste("Level",0:3), col=1:4, lwd=2, box.lty=0)
## graph with ggplot
p <- NULL
for (k in 1:7){
ICC <- info_modIRT$LevelInfo[which(info_modIRT$LevelInfo[,1]==items[k]),]
p[[k]] <- (ggplot(ICC)
+ geom_line(aes(x = Lprocess, y = Prob, group = Level,color=Level), show.legend = F,alpha = 1,size=1.2)
# + stat_smooth(aes(x = time, y = hads_scorea), method = "loess", size = 0.75)
+ theme_bw()
+ labs(title=paste("Item",2*k,"-",meaning[k]))
+ xlab("construct")
+ ylim(0,1)
+ ylab("Probability of item level"))
}
p[[8]] <- (ggplot(ICC)
+ geom_line(aes(x = Lprocess, y = Prob, group = Level,color=Level),alpha = 1,size=1.2)
+ theme_bw()
)
legend <- get_legend(p[[8]])
grid.arrange(p[[1]],p[[2]],p[[3]],p[[4]],p[[5]],p[[6]],p[[7]],as_ggplot(legend),ncol=4)
The following code computes the expectation of each item according to the underlying level of depressive symptomatology. This is achieved with predictYcond function with two plot possibilities: direct plot function or ggplot
expe <- predictYcond(modIRT,lprocess = seq(-6,6,by=0.1))
# via the internal plot function
plot(expe, xlab="underlying depressive symptomatology", main="Item Expectation Curves",
legend=paste("Item",(1:nitems)*2), lwd=2)
# via ggplot
j <- table(expe$pred$Yname)[1]
expe$pred$item <- as.factor(c(rep(2,j),rep(4,j),rep(6,j),rep(8,j),rep(10,j),rep(12,j),rep(14,j)))
p <- (ggplot(expe$pred)
+ geom_line(aes(x = Lprocess, y = Ypred, group=item,color=item),alpha = 1,size=1.2)
+ theme_bw()
+ xlab("underlying depressive symptomatology")
+ ylim(0,3)
+ ylab("Item Expectation"))
p
The level of information brought by each item category (information share) and brought in total by each item is also computed by the ItemInfo function. The curves can be again plotted directly with options which=“LevelInfo” and which=“ItemInfo” respectively.
par(mfrow=c(2,4), mar=c(3,2,2,1), mgp=c(2,0.5,0))
for(k in 1:7)
{
plot(info_modIRT, which="LevelInfo", outcome=items[k],
main=paste("Item",2*k,"-",meaning[k]), lwd=2, legend=NULL, ylim=c(0,1.3))
}
plot(0,axes=FALSE, xlab="", ylab="", col="white")
legend("center", legend=paste("Level",0:3), col=1:4, lwd=2, box.lty=0)
Item predicted trajectories according to a specific profile of covariates can be computed using predictY function:
head(datnew)
datnew$grp <- 0
ns0 <- predictY(modIRT,var.time = "time",newdata=datnew,methInteg = 1,nsim=2000,draws=T)
datnew$grp <- 1
ns1 <- predictY(modIRT,var.time = "time",newdata=datnew,methInteg = 1,nsim=2000,draws=T)
par(mfrow=c(2,4), mar=c(3,2,2,1), mgp=c(2,0.5,0))
for(k in 1:7){
plot(ns0,outcome = k,shades = T,ylim=c(0,3),bty="l",legend=NULL,main=paste("Item",2*k,"-",meaning[k]),ylab="Item level",xlab="months on the waiting list")
plot(ns1,outcome=k,shades=T,add=T,col=2)
}
DIF is programmed using contrasts (item-specific departure around the mean effect on the underlying latent process)
# initialization of the parameter vector for faster convergence
npm <- length(modIRT$best)
Binit <- c(modIRT$best[1:7],rep(0,(nitems-1)),modIRT$best[(npm-nlevel*nitems-9+1):npm])
# estimation
modIRT_DIFg <- multlcmm(hads_2 + hads_4 +hads_6 + hads_8 +hads_10+hads_12 + hads_14 ~ ns(time,knots=c(7,15),Boundary.knots = c(0,60))*(grp) +contrast(grp),random=~1+ns(time,knots=c(7,15),Boundary.knots = c(0,60)),data=simdataHADS,subject="ID",link="thresholds",methInteg="QMC",nMC=1000,B=Binit)
sumDIF <- summary(modIRT_DIFg)
#> General latent class mixed model
#> fitted by maximum likelihood method
#>
#> multlcmm(fixed = hads_2 + hads_4 + hads_6 + hads_8 + hads_10 +
#> hads_12 + hads_14 ~ ns(time, knots = c(7, 15), Boundary.knots = c(0,
#> 60)) * (grp) + contrast(grp), random = ~1 + ns(time, knots = c(7,
#> 15), Boundary.knots = c(0, 60)), subject = "ID", link = "thresholds",
#> data = simdataHADS, methInteg = "QMC", nMC = 1000)
#>
#> Statistical Model:
#> Dataset: simdataHADS
#> Number of subjects: 561
#> Number of observations: 7980
#> Number of latent classes: 1
#> Number of parameters: 50
#> Link functions: Thresholds for hads_2
#> Thresholds for hads_4
#> Thresholds for hads_6
#> Thresholds for hads_8
#> Thresholds for hads_10
#> Thresholds for hads_12
#> Thresholds for hads_14
#>
#> Iteration process:
#> Convergence criteria satisfied
#> Number of iterations: 18
#> Convergence criteria: parameters= 5.5e-10
#> : likelihood= 7.2e-07
#> : second derivatives= 3.5e-06
#>
#> Goodness-of-fit statistics:
#> maximum log-likelihood: -7215.26
#> AIC: 14530.53
#> BIC: 14747.01
#>
#> Maximum Likelihood Estimates:
#>
#> Fixed effects in the longitudinal model:
#>
#> coef Se
#> intercept (not estimated) 0.00000
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.13297 0.14024
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.20664 0.29380
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.55506 0.22402
#> grp -0.57337 0.17193
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1:grp 0.23311 0.20130
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2:grp 0.47086 0.39851
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3:grp -0.06025 0.33328
#> Contrasts on grp (p=0.29649)
#> hads_2 -0.02615 0.05552
#> hads_4 -0.02251 0.05210
#> hads_6 -0.00976 0.07969
#> hads_8 0.03271 0.06527
#> hads_10 -0.09166 0.07983
#> hads_12 -0.10547 0.05426
#> hads_14** 0.22284 0.10823
#> Wald p-value
#> intercept (not estimated)
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.948 0.34306
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.703 0.48184
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 2.478 0.01322
#> grp -3.335 0.00085
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1:grp 1.158 0.24685
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2:grp 1.182 0.23738
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3:grp -0.181 0.85654
#> Contrasts on grp (p=0.29649)
#> hads_2 -0.471 0.63768
#> hads_4 -0.432 0.66569
#> hads_6 -0.123 0.90249
#> hads_8 0.501 0.61624
#> hads_10 -1.148 0.25087
#> hads_12 -1.944 0.05191
#> hads_14** 2.059 0.03951
#>
#>
#> Variance-covariance matrix of the random-effects:
#> (the variance of the first random effect is not estimated)
#> intercept
#> intercept 1.00000
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.34300
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 -1.00695
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 -0.09042
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 0.65939
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.79736
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.40205
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 2.13395
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.30725
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.2742
#>
#> hads_2 hads_4 hads_6 hads_8 hads_10 hads_12
#> Residual standard error: 0.78759 0.63370 1.03198 1.00051 1.06841 0.68928
#> hads_14
#> Residual standard error: 1.56386
#>
#> Parameters of the link functions:
#>
#> coef Se Wald p-value
#> hads_2-Thresh1 -0.54084 0.14279 -3.788 0.00015
#> hads_2-Thresh2 1.12629 0.05507 20.453 0.00000
#> hads_2-Thresh3 0.88989 0.05133 17.335 0.00000
#> hads_4-Thresh1 -0.23444 0.13672 -1.715 0.08638
#> hads_4-Thresh2 1.01263 0.04931 20.536 0.00000
#> hads_4-Thresh3 1.04536 0.05931 17.624 0.00000
#> hads_6-Thresh1 -0.37640 0.15232 -2.471 0.01347
#> hads_6-Thresh2 1.35142 0.07135 18.942 0.00000
#> hads_6-Thresh3 1.32355 0.09637 13.734 0.00000
#> hads_8-Thresh1 -1.34484 0.18696 -7.193 0.00000
#> hads_8-Thresh2 1.33742 0.06746 19.826 0.00000
#> hads_8-Thresh3 1.09662 0.06048 18.133 0.00000
#> hads_10-Thresh1 -0.05778 0.14266 -0.405 0.68549
#> hads_10-Thresh2 1.01150 0.05570 18.161 0.00000
#> hads_10-Thresh3 1.11286 0.06683 16.653 0.00000
#> hads_12-Thresh1 -0.24864 0.13642 -1.823 0.06837
#> hads_12-Thresh2 1.00115 0.05013 19.970 0.00000
#> hads_12-Thresh3 1.03304 0.05981 17.271 0.00000
#> hads_14-Thresh1 1.01531 0.20581 4.933 0.00000
#> hads_14-Thresh2 1.46240 0.09729 15.032 0.00000
#> hads_14-Thresh3 0.85364 0.09947 8.582 0.00000
#>
#> ** coefficient not estimated but obtained from the others as minus the sum of them
#>
sumDIF[,2]
#> intercept (not estimated)
#> NA
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> 0.14024
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2
#> 0.29380
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3
#> 0.22402
#> grp
#> 0.17193
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1:grp
#> 0.20130
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2:grp
#> 0.39851
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3:grp
#> 0.33328
#> Contrasts on grp (p=0.29649)
#> NA
#> hads_2
#> 0.05552
#> hads_4
#> 0.05210
#> hads_6
#> 0.07969
#> hads_8
#> 0.06527
#> hads_10
#> 0.07983
#> hads_12
#> 0.05426
#> hads_14**
#> 0.10823
To be done again …. L’item 2 est le seul item qui semble être différent entre les groupes (p=0.0071) avec un niveau plus faible chez les preemptive par rapport aux autres items. Au global, la différence de groupe entre les 7 items ne semble pas significative (p=0.2665 au global (Chi2 à 6 degrés de liberté)).
Global test for contrasts
WaldMult(modIRT_DIFg,pos=c(8:13))
#> Wald Test
#> contrast11 = contrast12 = contrast13 = contrast14 = contrast15 = contrast16 = 0 7.27124
#> p_value
#> contrast11 = contrast12 = contrast13 = contrast14 = contrast15 = contrast16 = 0 0.29649
95% confidence interval of the difference between groups for item 2:
sum <- summary(modIRT_DIFg)[10,]
#> General latent class mixed model
#> fitted by maximum likelihood method
#>
#> multlcmm(fixed = hads_2 + hads_4 + hads_6 + hads_8 + hads_10 +
#> hads_12 + hads_14 ~ ns(time, knots = c(7, 15), Boundary.knots = c(0,
#> 60)) * (grp) + contrast(grp), random = ~1 + ns(time, knots = c(7,
#> 15), Boundary.knots = c(0, 60)), subject = "ID", link = "thresholds",
#> data = simdataHADS, methInteg = "QMC", nMC = 1000)
#>
#> Statistical Model:
#> Dataset: simdataHADS
#> Number of subjects: 561
#> Number of observations: 7980
#> Number of latent classes: 1
#> Number of parameters: 50
#> Link functions: Thresholds for hads_2
#> Thresholds for hads_4
#> Thresholds for hads_6
#> Thresholds for hads_8
#> Thresholds for hads_10
#> Thresholds for hads_12
#> Thresholds for hads_14
#>
#> Iteration process:
#> Convergence criteria satisfied
#> Number of iterations: 18
#> Convergence criteria: parameters= 5.5e-10
#> : likelihood= 7.2e-07
#> : second derivatives= 3.5e-06
#>
#> Goodness-of-fit statistics:
#> maximum log-likelihood: -7215.26
#> AIC: 14530.53
#> BIC: 14747.01
#>
#> Maximum Likelihood Estimates:
#>
#> Fixed effects in the longitudinal model:
#>
#> coef Se
#> intercept (not estimated) 0.00000
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.13297 0.14024
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.20664 0.29380
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.55506 0.22402
#> grp -0.57337 0.17193
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1:grp 0.23311 0.20130
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2:grp 0.47086 0.39851
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3:grp -0.06025 0.33328
#> Contrasts on grp (p=0.29649)
#> hads_2 -0.02615 0.05552
#> hads_4 -0.02251 0.05210
#> hads_6 -0.00976 0.07969
#> hads_8 0.03271 0.06527
#> hads_10 -0.09166 0.07983
#> hads_12 -0.10547 0.05426
#> hads_14** 0.22284 0.10823
#> Wald p-value
#> intercept (not estimated)
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.948 0.34306
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.703 0.48184
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 2.478 0.01322
#> grp -3.335 0.00085
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1:grp 1.158 0.24685
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2:grp 1.182 0.23738
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3:grp -0.181 0.85654
#> Contrasts on grp (p=0.29649)
#> hads_2 -0.471 0.63768
#> hads_4 -0.432 0.66569
#> hads_6 -0.123 0.90249
#> hads_8 0.501 0.61624
#> hads_10 -1.148 0.25087
#> hads_12 -1.944 0.05191
#> hads_14** 2.059 0.03951
#>
#>
#> Variance-covariance matrix of the random-effects:
#> (the variance of the first random effect is not estimated)
#> intercept
#> intercept 1.00000
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.34300
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 -1.00695
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 -0.09042
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 0.65939
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.79736
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.40205
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 2.13395
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.30725
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.2742
#>
#> hads_2 hads_4 hads_6 hads_8 hads_10 hads_12
#> Residual standard error: 0.78759 0.63370 1.03198 1.00051 1.06841 0.68928
#> hads_14
#> Residual standard error: 1.56386
#>
#> Parameters of the link functions:
#>
#> coef Se Wald p-value
#> hads_2-Thresh1 -0.54084 0.14279 -3.788 0.00015
#> hads_2-Thresh2 1.12629 0.05507 20.453 0.00000
#> hads_2-Thresh3 0.88989 0.05133 17.335 0.00000
#> hads_4-Thresh1 -0.23444 0.13672 -1.715 0.08638
#> hads_4-Thresh2 1.01263 0.04931 20.536 0.00000
#> hads_4-Thresh3 1.04536 0.05931 17.624 0.00000
#> hads_6-Thresh1 -0.37640 0.15232 -2.471 0.01347
#> hads_6-Thresh2 1.35142 0.07135 18.942 0.00000
#> hads_6-Thresh3 1.32355 0.09637 13.734 0.00000
#> hads_8-Thresh1 -1.34484 0.18696 -7.193 0.00000
#> hads_8-Thresh2 1.33742 0.06746 19.826 0.00000
#> hads_8-Thresh3 1.09662 0.06048 18.133 0.00000
#> hads_10-Thresh1 -0.05778 0.14266 -0.405 0.68549
#> hads_10-Thresh2 1.01150 0.05570 18.161 0.00000
#> hads_10-Thresh3 1.11286 0.06683 16.653 0.00000
#> hads_12-Thresh1 -0.24864 0.13642 -1.823 0.06837
#> hads_12-Thresh2 1.00115 0.05013 19.970 0.00000
#> hads_12-Thresh3 1.03304 0.05981 17.271 0.00000
#> hads_14-Thresh1 1.01531 0.20581 4.933 0.00000
#> hads_14-Thresh2 1.46240 0.09729 15.032 0.00000
#> hads_14-Thresh3 0.85364 0.09947 8.582 0.00000
#>
#> ** coefficient not estimated but obtained from the others as minus the sum of them
#>
c(sum[1],sum[1]- qnorm(0.975)*sum[2],sum[1]+ qnorm(0.975)*sum[2])
#> coef coef coef
#> -0.0261500 -0.1349672 0.0826672
Response Shift is modelled by adding contrasts on the functions of time
# initialization of the parameter vector for faster convergence
npm <- length(modIRT$best)
Binit <- c(modIRT$best[1:7],rep(0,3*(nitems-1)),modIRT$best[(npm-nlevel*nitems-9+1):npm])
# estimation
modIRT_DIFt <- multlcmm(hads_2 + hads_4 +hads_6 + hads_8 +hads_10+hads_12 + hads_14 ~ ns(time,knots=c(7,15),Boundary.knots = c(0,60))*(grp) + contrast(ns(time,knots=c(7,15),Boundary.knots = c(0,60))),random=~1+ns(time,knots=c(7,15),Boundary.knots = c(0,60)),data=simdataHADS,subject="ID",link="thresholds",methInteg="QMC",nMC=1000,B=Binit)
summary(modIRT_DIFt)
#> General latent class mixed model
#> fitted by maximum likelihood method
#>
#> multlcmm(fixed = hads_2 + hads_4 + hads_6 + hads_8 + hads_10 +
#> hads_12 + hads_14 ~ ns(time, knots = c(7, 15), Boundary.knots = c(0,
#> 60)) * (grp) + contrast(ns(time, knots = c(7, 15), Boundary.knots = c(0,
#> 60))), random = ~1 + ns(time, knots = c(7, 15), Boundary.knots = c(0,
#> 60)), subject = "ID", link = "thresholds", data = simdataHADS,
#> methInteg = "QMC", nMC = 1000)
#>
#> Statistical Model:
#> Dataset: simdataHADS
#> Number of subjects: 561
#> Number of observations: 7980
#> Number of latent classes: 1
#> Number of parameters: 62
#> Link functions: Thresholds for hads_2
#> Thresholds for hads_4
#> Thresholds for hads_6
#> Thresholds for hads_8
#> Thresholds for hads_10
#> Thresholds for hads_12
#> Thresholds for hads_14
#>
#> Iteration process:
#> Convergence criteria satisfied
#> Number of iterations: 38
#> Convergence criteria: parameters= 1.7e-06
#> : likelihood= 1.6e-05
#> : second derivatives= 2.1e-05
#>
#> Goodness-of-fit statistics:
#> maximum log-likelihood: -7206.7
#> AIC: 14537.4
#> BIC: 14805.84
#>
#> Maximum Likelihood Estimates:
#>
#> Fixed effects in the longitudinal model:
#>
#> coef
#> intercept (not estimated) 0.00000
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.15670
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.23260
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.54188
#> grp -0.60304
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1:grp 0.23158
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2:grp 0.47346
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3:grp -0.05625
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 (p=0.20081)
#> hads_2 0.08729
#> hads_4 0.11625
#> hads_6 -0.44754
#> hads_8 0.07570
#> hads_10 0.02299
#> hads_12 0.07366
#> hads_14** 0.07165
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 (p=0.29467)
#> hads_2 0.04846
#> hads_4 0.31419
#> hads_6 -0.12537
#> hads_8 -0.16013
#> hads_10 -0.49717
#> hads_12 -0.22330
#> hads_14** 0.64332
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 (p=0.25871)
#> hads_2 0.09527
#> hads_4 0.26310
#> hads_6 0.07205
#> hads_8 -0.10425
#> hads_10 -0.22343
#> hads_12 -0.21563
#> hads_14** 0.11289
#> Se
#> intercept (not estimated)
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 0.17358
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.82370
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.17632
#> grp 0.59386
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1:grp 0.23305
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2:grp 1.10893
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3:grp 0.42697
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 (p=0.20081)
#> hads_2 0.12368
#> hads_4 0.11111
#> hads_6 0.16139
#> hads_8 0.14550
#> hads_10 0.15418
#> hads_12 0.11400
#> hads_14** 0.25382
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 (p=0.29467)
#> hads_2 0.22799
#> hads_4 0.21434
#> hads_6 0.35246
#> hads_8 0.26551
#> hads_10 0.27058
#> hads_12 0.47554
#> hads_14** 0.48952
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 (p=0.25871)
#> hads_2 0.14528
#> hads_4 0.13281
#> hads_6 0.20025
#> hads_8 0.16574
#> hads_10 0.17771
#> hads_12 0.13640
#> hads_14** 0.28994
#> Wald
#> intercept (not estimated)
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.903
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.282
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 3.073
#> grp -1.015
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1:grp 0.994
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2:grp 0.427
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3:grp -0.132
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 (p=0.20081)
#> hads_2 0.706
#> hads_4 1.046
#> hads_6 -2.773
#> hads_8 0.520
#> hads_10 0.149
#> hads_12 0.646
#> hads_14** 0.282
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 (p=0.29467)
#> hads_2 0.213
#> hads_4 1.466
#> hads_6 -0.356
#> hads_8 -0.603
#> hads_10 -1.837
#> hads_12 -0.470
#> hads_14** 1.314
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 (p=0.25871)
#> hads_2 0.656
#> hads_4 1.981
#> hads_6 0.360
#> hads_8 -0.629
#> hads_10 -1.257
#> hads_12 -1.581
#> hads_14** 0.389
#> p-value
#> intercept (not estimated)
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 0.36667
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.77764
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.00212
#> grp 0.30989
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1:grp 0.32037
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2:grp 0.66941
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3:grp 0.89519
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 (p=0.20081)
#> hads_2 0.48034
#> hads_4 0.29546
#> hads_6 0.00555
#> hads_8 0.60290
#> hads_10 0.88145
#> hads_12 0.51819
#> hads_14** 0.77772
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 (p=0.29467)
#> hads_2 0.83167
#> hads_4 0.14270
#> hads_6 0.72205
#> hads_8 0.54644
#> hads_10 0.06615
#> hads_12 0.63865
#> hads_14** 0.18878
#> Contrasts on ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 (p=0.25871)
#> hads_2 0.51199
#> hads_4 0.04759
#> hads_6 0.71900
#> hads_8 0.52933
#> hads_10 0.20866
#> hads_12 0.11392
#> hads_14** 0.69701
#>
#>
#> Variance-covariance matrix of the random-effects:
#> (the variance of the first random effect is not estimated)
#> intercept
#> intercept 1.00000
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 -0.34985
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 -1.01606
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 -0.09265
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1 0.64899
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 0.79384
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.39651
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2 2.12919
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.30894
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3
#> intercept
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))1
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))2
#> ns(time, knots = c(7, 15), Boundary.knots = c(0, 60))3 0.27109
#>
#> hads_2 hads_4 hads_6 hads_8 hads_10 hads_12
#> Residual standard error: 0.78529 0.63525 1.01983 0.99728 1.03501 0.66202
#> hads_14
#> Residual standard error: 1.62216
#>
#> Parameters of the link functions:
#>
#> coef Se Wald p-value
#> hads_2-Thresh1 -0.51941 0.53286 -0.975 0.32968
#> hads_2-Thresh2 1.12436 0.07485 15.022 0.00000
#> hads_2-Thresh3 0.88847 0.06515 13.638 0.00000
#> hads_4-Thresh1 -0.11811 0.49181 -0.240 0.81021
#> hads_4-Thresh2 1.01475 0.06821 14.877 0.00000
#> hads_4-Thresh3 1.04881 0.07780 13.480 0.00000
#> hads_6-Thresh1 -0.45610 0.52238 -0.873 0.38260
#> hads_6-Thresh2 1.34774 0.09060 14.876 0.00000
#> hads_6-Thresh3 1.32073 0.11019 11.985 0.00000
#> hads_8-Thresh1 -1.41857 0.57951 -2.448 0.01437
#> hads_8-Thresh2 1.33452 0.08270 16.138 0.00000
#> hads_8-Thresh3 1.09520 0.07350 14.900 0.00000
#> hads_10-Thresh1 -0.21289 0.51793 -0.411 0.68105
#> hads_10-Thresh2 0.99702 0.06882 14.487 0.00000
#> hads_10-Thresh3 1.09847 0.08025 13.689 0.00000
#> hads_12-Thresh1 -0.25845 0.74848 -0.345 0.72987
#> hads_12-Thresh2 0.98380 0.07480 13.152 0.00000
#> hads_12-Thresh3 1.01692 0.07751 13.121 0.00000
#> hads_14-Thresh1 1.21337 0.46343 2.618 0.00884
#> hads_14-Thresh2 1.48581 0.11544 12.871 0.00000
#> hads_14-Thresh3 0.86655 0.10687 8.109 0.00000
#>
#> ** coefficient not estimated but obtained from the others as minus the sum of them
#>
There does not seem to be any difference in item trajectories over time (see global p-values for each function of time in the summary). We can seek whether there are some difference item by item using Wald Test. This can be done with the WaldMult function of lcmm except for the last item since this parameter is a combination of the others. Next code details how to obtain this item-specific test of invariance over time.
## Pvalue for the last contrast
b <- coef(modIRT_DIFt)
v <- vcov(modIRT_DIFt)
A <- rbind(c(rep(0,7), rep(-1,6), rep(0,49)),
c(rep(0,7+6), rep(-1,6), rep(0,49-6)),
c(rep(0,7+12), rep(-1,6), rep(0,49-12)))
w <- t(A%*%b) %*% solve(A%*%v%*%t(A)) %*% A%*%b
DIF14 <- 1-pchisq(w, df=nrow(A)) # p=0.3722833
## pvalues for all the items including the last one
DIF <- cbind(seq(2,14,by=2),c(sapply(1:6,function(k){WaldMult(modIRT_DIFt,pos=c(7+k,(7+6+k),(7+2*6+k)))[2]}),DIF14))
colnames(DIF) <- c("item","pvalue")
DIF
#> item pvalue
#> [1,] 2 0.7396200
#> [2,] 4 0.1194600
#> [3,] 6 0.0497800
#> [4,] 8 0.8796300
#> [5,] 10 0.3235800
#> [6,] 12 0.4146500
#> [7,] 14 0.5957915
Interpretation.
head(datnew)
datnew$grp <- 0
ns0DIFt <- predictY(modIRT_DIFt,var.time = "time",newdata=datnew,methInteg = 1,nsim=2000,draws=T)
datnew$grp <- 1
ns1DIFt <- predictY(modIRT_DIFt,var.time = "time",newdata=datnew,methInteg = 1,nsim=2000,draws=T)
par(mfrow=c(3,3), mar=c(3,2,2,1), mgp=c(2,0.5,0))
for(k in 1:7){
plot(ns0,outcome = k,shades = T,ylim=c(0,3),bty="l",legend=NULL,main=paste("Item",2*k,"-",meaning[k]),ylab="Item level",xlab="months on the waiting list",color=1,lwd=2,xlim=c(0,50))
plot(ns0DIFt,outcome=k,shades=T,lty=2,add=T,col=1,lwd=2)
plot(ns1,outcome=k,shades=T,add=T,col=4,lwd=2)
plot(ns1DIFt,outcome=k,shades=T,add=T,col=4,lty=2,lwd=2)
legend("top",legend=paste("(RS overall test: p = ",round(DIF[k,2],digits = 3),")",sep=""),bty="n")
}
plot(0,xaxt='n',yaxt='n',bty='n',pch='',ylab='',xlab='', main ='')
legend(x="top",legend=c("dialysed","pre-emptive"),lty=c(1,1),col=c(1,4),lwd=2,bty="n")
legend(x="bottom",legend=c("without RS","with RS"),lty=c(1,2),col=c("gray","gray"),lwd=2,bty="n")