# NOT RUN {
#Two group model, all parameters except LAMBDA[3,1] constrained across groups.
data(ctExample4)
basemodel<-ctModel(n.latent=1, n.manifest=3, Tpoints=20,
LAMBDA=matrix(c(1, 'lambda2', 'lambda3'), nrow=3, ncol=1),
MANIFESTMEANS=matrix(c(0, 'manifestmean2', 'manifestmean3'),
nrow=3, ncol=1), TRAITVAR = 'auto')
freemodel<-basemodel
freemodel$LAMBDA[3,1]<-'groupfree'
groups<-paste0('g',rep(1:2, each=10),'_')
multif<-ctMultigroupFit(dat=ctExample4, groupings=groups,
ctmodelobj=basemodel, freemodel=freemodel)
summary(multif,group=1)
#fixed model approach
fixedmodel<-basemodel
fixedmodel$LAMBDA[2,1]<-'groupfixed'
groups<-paste0('g',rep(1:2, each=10),'_')
multif<-ctMultigroupFit(dat=ctExample4, groupings=groups,
ctmodelobj=basemodel, fixedmodel=fixedmodel)
summary(multif)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab