Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ctFitMultiModel

Fit and summarise a list of ctsem models


Description

Fit and summarise a list of ctsem models

Usage

ctFitMultiModel(
  mlist,
  datalong,
  type = "stanct",
  cores = 2,
  summaryOutput = TRUE,
  saveFits = TRUE,
  summaryArgs = list(),
  ...
)

Arguments

mlist

Named list of models

datalong

ctsem long format data

type

'stanct' for continuous time or 'standt' for discrete time

cores

number of cpu cores to use

summaryOutput

Generate summary output into ctSummary folder? Large datasets can take some time.

saveFits

Save fit objects to working directory?

summaryArgs

Additional arguments for ctSummarise.

...

Additional arguments for ctStanFit.

Value

List containing a named list of model fits ($fits), and a compare object ($compare)

Examples

## Not run: 
if(w32chk()){
sunspots<-data.frame(id=1,
  time=do.call(seq,(lapply(attributes(sunspot.year)$tsp,function(x) x))),
  sunspots=sunspot.year)

 ssmodel1 <- ctModel(type='omx', manifestNames='sunspots', Tpoints=3,
  latentNames=c('ss_level', 'ss_velocity'),
   LAMBDA=matrix(c( 1, 'ma1| log(1+(exp(param)))' ), nrow=1, ncol=2),
   DRIFT=matrix(c(0, 'a21 | -log(1+exp(param))', 1, 'a22'), nrow=2, ncol=2),
   MANIFESTMEANS=matrix(c('m1|param * 10 + 44'), nrow=1, ncol=1),
   MANIFESTVAR=diag(0,1), #As per original spec
   CINT=matrix(c(0, 0), nrow=2, ncol=1),
   DIFFUSION=matrix(c(0, 0, 0, "diffusion"), ncol=2, nrow=2))
 
 ssmodel2 <- ssmodel1
 ssmodel2$LAMBDA[2] <- 0
 
 fits<-ctFitMultiModel(list(m1=ssmodel1,m2=ssmodel2),datalong = sunspots,
   summaryOutput = FALSE,saveFits = FALSE,cores=1)
 print(fits$compare)
}

## End(Not run)

ctsem

Continuous Time Structural Equation Modelling

v3.4.3
GPL-3
Authors
Charles Driver [aut, cre, cph], Manuel Voelkle [aut, cph], Han Oud [aut, cph], Trustees of Columbia University [cph]
Initial release
2021-04-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.