ctsem (version 3.0.4)

ctStanUpdModel: Update an already compiled and fit ctStanFit object

Description

Allows one to change data and or model elements that don't require recompiling, then re fit.

Usage

ctStanUpdModel(fit, datalong, ctstanmodel, ...)

Arguments

fit

ctStanFit object

datalong

data as normally passed to ctStanFit

ctstanmodel

model as normally passed to ctStanFit

...

extra args for ctStanFit

Examples

Run this code
# NOT RUN {
 newm<-ctModel(type='stanct',
  n.latent=ctstantestfit$ctstanmodel$n.latent,
  n.TDpred=ctstantestfit$ctstanmodel$n.TDpred,
  n.TIpred=ctstantestfit$ctstanmodel$n.TIpred,
  MANIFESTVAR=matrix(c('merror',0,0,'merror'),2,2),
  MANIFESTMEANS=matrix(0,nrow=ctstantestfit$ctstanmodel$n.manifest),
  CINT=matrix(c(0,'cint2'),ncol=1),
  n.manifest=ctstantestfit$ctstanmodel$n.manifest,
  LAMBDA=diag(2))
  
 newdat <- ctstantestdat
 newdat <- newdat[newdat[,'id']!=1,]
 newfit <- ctStanUpdModel(ctstantestfit, newdat, newm)
 
# }

Run the code above in your browser using DataLab