# NOT RUN {
#test data with 2 manifest indicators measuring 1 latent process each,
# 1 time dependent predictor, 3 time independent predictors
head(ctstantestdat)
#generate a ctStanModel
model<-ctModel(type='stanct',
n.latent=2, latentNames=c('eta1','eta2'),
n.manifest=2, manifestNames=c('Y1','Y2'),
n.TDpred=1, TDpredNames='TD1',
n.TIpred=3, TIpredNames=c('TI1','TI2','TI3'),
LAMBDA=diag(2))
#set all parameters except manifest means to be fixed across subjects
model$pars$indvarying[-c(19,20)] <- FALSE
#fit model to data (takes a few minutes - but insufficient
# iterations and max_treedepth for inference!)
fit<-ctStanFit(ctstantestdat, model, iter=200, chains=2,
control=list(max_treedepth=6))
#output functions
summary(fit)
plot(fit)
# }
Run the code above in your browser using DataLab