ctmaInit {CoTiMA} | R Documentation |

Fits ctsem models to each primary study in the supplied list of primary studies prepared by `ctmaPrep`

.

ctmaInit( primaryStudies = NULL, activeDirectory = NULL, activateRPB = FALSE, checkSingleStudyResults = TRUE, digits = 4, n.latent = NULL, n.manifest = 0, lambda = NULL, manifestVars = NULL, drift = NULL, indVarying = FALSE, saveRawData = list(), coresToUse = c(1), silentOverwrite = FALSE, saveSingleStudyModelFit = c(), loadSingleStudyModelFit = c(), scaleTI = NULL, scaleTime = NULL, optimize = TRUE, nopriors = TRUE, finishsamples = NULL, chains = NULL, iter = NULL, verbose = NULL, customPar = FALSE, doPar = 1, useSV = TRUE )

`primaryStudies` |
list of primary study information created with |

`activeDirectory` |
defines another active directory than the one used in |

`activateRPB` |
set to TRUE to receive push messages with 'CoTiMA' notifications on your phone |

`checkSingleStudyResults` |
Displays estimates from single study ctsem models and waits for user input to continue. Useful to check estimates before they are saved. |

`digits` |
number of digits used for rounding (in outputs) |

`n.latent` |
number of latent variables of the model (hast to be specified)! |

`n.manifest` |
number of manifest variables of the model (if left empty it will assumed to be identical with n.latent). |

`lambda` |
R-type matrix with pattern of fixed (=1) or free (any string) loadings. |

`manifestVars` |
define the error variances of the manifests with a single time point using R-type matrix with nrow=n.manifest & ncol=n.manifest. |

`drift` |
labels for drift effects. Have to be either of the type V1toV2 or 0 for effects to be excluded, which is usually not recommended) |

`indVarying` |
control for unobserved heterogeneity by having randomly (inter-individually) varying manifest means |

`saveRawData` |
save (created pseudo) raw date. List: saveRawData$studyNumbers, $fileName, $row.names, col.names, $sep, $dec |

`coresToUse` |
if neg., the value is subtracted from available cores, else value = cores to use |

`silentOverwrite` |
overwrite old files without asking |

`saveSingleStudyModelFit` |
save the fit of single study ctsem models (could save a lot of time afterwards if the fit is loaded) |

`loadSingleStudyModelFit` |
load the fit of single study ctsem models |

`scaleTI` |
scale TI predictors |

`scaleTime` |
scale time (interval) - sometimes desirable to improve fitting |

`optimize` |
if set to FALSE, Stan's Hamiltonian Monte Carlo sampler is used (default = TRUE = maximum a posteriori / importance sampling) . |

`nopriors` |
if TRUE, any priors are disabled - sometimes desirable for optimization |

`finishsamples` |
number of samples to draw (either from hessian based covariance or posterior distribution) for final results computation (default = 1000). |

`chains` |
number of chains to sample, during HMC or post-optimization importance sampling. |

`iter` |
number of interation (defaul = 1000). Sometimes larger values could be required fom Bayesian estimation |

`verbose` |
integer from 0 to 2. Higher values print more information during model fit - for debugging |

`customPar` |
logical. Leverages the first pass using priors and ensure that the drift diagonal cannot easily go too negative (could help with ctsem > 3.4) |

`doPar` |
parallel and multiple fitting if single studies |

`useSV` |
if TRUE (default) start values will be used if provided in the list of primary studies |

ctmaFit returns a list containing some arguments supplied, the fitted models, different elements summarizing the main results, model type, and the type of plot that could be performed with the returned object. The arguments in the returned object are activeDirectory, coresToUse, n.latent, n.manifest, and primaryStudyList. The study count is returned as n.studies, the created matrix of loadings of manifest on latent factors is returned as lambda, and a re-organized list of primary studies with some information ommited is returned as studyList. The fitted models for each primary study are found in studyFitList, which is a large list with many elements (e.g., the ctsem model specified by CoTiMA, the rstan model created by ctsem, the fitted rstan model etc.). Further results returned are emprawList (containing the pseudo raw data created), statisticsList (comprising baisc stats such as average sample size, no. of measurement points, etc.), a list with modelResults (i.e., DRIFT=model_Drift_Coef, DIFFUSION=model_Diffusion_Coef, T0VAR=model_T0var_Coef, CINT=model_Cint_Coef), and the paramter names internally used. The summary list, which is printed if the summary function is applied to the returned object, comprises "estimates" (the aggregated effects), possible randomEffects (not yet fully working), confidenceIntervals, the minus2ll value and its n.parameters, and possible warning messages (message). Plot type is plot.type=c("drift") and model.type="stanct" ("omx" was deprecated).

# Fit a ctsem model to all three primary studies summarized in # CoTiMAstudyList_3 and save the three fitted models ## Not run: CoTiMAInitFit_3 <- ctmaInit(primaryStudies=CoTiMAstudyList_3, n.latent=2, checkSingleStudyResults=FALSE, activeDirectory="/Users/tmp/") # adapt! summary(CoTiMAInitFit_3) ## End(Not run)

[Package *CoTiMA* version 0.4.0 Index]