set.seed(1)
data = simLong(n = 17,p = 6,rel_p = 6,time_points = 10,rho_W = 0.6, rho_Z=0.6,
random_sd_intercept = sqrt(0.5),
random_sd_slope = sqrt(3),
noise_sd = 0.5,linear=FALSE) # Generate the data
head(data) # first six rows of the data.
# Let's see the output :
w <- which(data$id==1)
plot(data$time[w],data$Y[w],type="l",ylim=c(min(data$Y),max(data$Y)), col="grey")
for (i in unique(data$id)){
w <- which(data$id==i)
lines(data$time[w],data$Y[w], col='grey')
}
# Let's see the fixed effects predictors:
oldpar <- par(no.readonly = TRUE)
oldopt <- options()
par(mfrow=c(2,3), mar=c(2,3,3,2))
for (i in 1:ncol(data[,-1:-5])){
w <- which(data$id==1)
plot(data$time[w],data[,-1:-5][w,i], col="grey",ylim=c(min(data[,-1:-5][,i]),
max(data[,-1:-5][,i])),xlim=c(1,max(data$time)),main=latex2exp::TeX(paste0("$X^{(",i,")}$")))
for (k in unique(data$id)){
w <- which(data$id==k)
lines(data$time[w],data[,-1:-5][w,i], col="grey")
}
}
par(oldpar)
options(oldopt)
Run the code above in your browser using DataLab