ctmaOptimizeInit {CoTiMA}R Documentation

ctmaOptimizeInit

Description

Initial fitting (i.e., applies ctmaInit) to a primary study reFit times to capitalize on chance for obtaining a hard-to-find optimal fit. This could be very helpful if a primary yields out-of-range estimates, which could happen if the fitting algorithm unfortunately used random start values that resulted in a locally but not globally optimal fit. Essentially, using ctmaOptimizeInit is like gambling, hoping that at leas one set of starting values (the number is tries is specified in the reFits argument) eneables finding the global optimal fit. On unix-like machines (e.g. MacOS), this could be done in parallel mode if coresToUse > 1.

Usage

ctmaOptimizeInit(
  primaryStudies = NULL,
  activeDirectory = NULL,
  problemStudy = NULL,
  reFits = NULL,
  n.latent = NULL,
  coresToUse = c(1),
  activateRPB = FALSE,
  checkSingleStudyResults = FALSE,
  customPar = FALSE
)

Arguments

primaryStudies

list of primary study information created with ctmaPrep or ctmaFitToPrep

activeDirectory

activeDirectory

problemStudy

number (position in list) where the problem study in primaryStudies is found

reFits

how many reFits should be done

n.latent

number of latent variables of the model (hast to be specified)!

coresToUse

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

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.

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)

Value

returns a list with bestFit (= the best fit achieved), all_minus2ll (= all -2ll values for all fitted models), and summary, which is printed if the summary function is applied to the returned object, and which shows the summary information of the ctsem model with the best fit.

Note

All but one of multiple cores are used on unix-type machines for parallel fitting

During fitting, not output is generated. Be patient.

Examples

## Not run: 
optimFit313 <- ctmaOptimizeInit(primaryStudies=CoTiMAstudyList_3,
                                activeDirectory="/Users/tmp/",  # adapt!
                                problemStudy=which(CoTiMAstudyList_3$studyNumbers == 313),
                                reFits=10,
                                n.latent=2)
summary(optimFit313)

## End(Not run)


[Package CoTiMA version 0.4.0 Index]