View source: R/exploratorySA.R
Exploratory CFA using Simulated Annealing
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | exploratorySA(
initialModels,
originalData,
maxSteps = 5000,
fitStatistic = "cfi",
maximize = TRUE,
Kirkpatrick = TRUE,
randomNeighbor = TRUE,
lavaan.model.specs = list(model.type = "cfa", auto.var = TRUE, estimator = "default",
ordered = NULL, int.ov.free = TRUE, int.lv.free = FALSE, std.lv = TRUE,
auto.fix.first = FALSE, auto.fix.single = TRUE, auto.cov.lv.x = TRUE, auto.th = TRUE,
auto.delta = TRUE, auto.cov.y = TRUE, missing = "listwise"),
maxChanges = 5,
restartCriteria = "consecutive",
maximumConsecutive = 25,
temperature = function(currentStep, maxSteps) { currentTemp <- ((maxSteps -
(currentStep))/maxSteps)^7 },
bifactor = FALSE,
...
)
|
initialModels |
The initial model as a 'character' vector with lavaan model syntax. Each starting model should be its own element in the vector. |
originalData |
The original 'data.frame' with variable names. |
maxSteps |
Numeric value for maximum number of steps for the simulated annealing algorithm. |
fitStatistic |
String indicating the fit statistic to use. Must be an appropriate fit statistic reported by ‘lavaan::fitstatistic'. Default is '’cfi''. |
maximize |
Logical. Is the chosen 'fitStatistic' to be maximized? Default is 'TRUE'. |
Kirkpatrick |
Default is 'TRUE' to use the Kirkpatrick goal function. Also accepts custom-defined goal functions. |
randomNeighbor |
Default is 'TRUE' to use the default random neighbor function. Also accepts custom-defined functions to specify how random neighbor models are generated. |
lavaan.model.specs |
A list of named values that specify the model specifications as found in 'lavaan::lavaan'. Default values match the values found for 'lavaan::cfa'. |
maxChanges |
An 'integer' value greater than 1 setting the maximum number of parameters to change within randomNeighbor. . |
restartCriteria |
Either "consecutive" to restart after maxConsecutiveSelection times with the same model chosen in a row, or a user-defined function. |
maximumConsecutive |
A positive 'integer' value used with restartCriteria. |
temperature |
Either an acceptable 'character' value, or a user-defined temperature function. The acceptable values are "linear", "quadratic", or "logistic". Defaults to a custom function. |
bifactor |
Logical. Indicates if the latent model is a bifactor model. If 'TRUE', assumes that the last latent variable in the provided model syntax is the bifactor (i.e., all of the retained items will be set to load on the last latent variable). Ignored if 'maxItems==FALSE'. |
... |
Further arguments to be passed to other functions. Not implemented for any of the included functions. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.