R/opt-nm-1_simsem.R
opt1.simsem.Rd
opt1.simsem
is an internal function that runs simulations using lavaan
and simsem
. It returns the optimal missing pattern that only contains one missing measured variable. This is the first step of forward assembly.
opt1.simsem(popModel, analyzeModel, NAMES, distal.var, n, nreps, seed, Time, k, Time.complete, costmx, pc, pd, focal.param, complete.var = NULL)
popModel | The data generation model (population model) specified using lavaan script. |
---|---|
analyzeModel | The analysis model, specified using lavaan script. The analysis model can be different from the population model. |
NAMES | A character vector containing the names of the observed variables. The variable names must be ordered chronologically, by the time (wave) they are measured. |
distal.var | Char vector. Specify the name(s) of the distal variables. User needs to specify this argument if there are any time-independent distal variables included in the model that are not subject to planned missingness. |
n | The total sample size as initially planned. |
nreps | Number of replications for Monte Carlo simulations. |
seed | The random seed for random number generation. |
Time | Numeric. The total number of time points (or total number of waves of data collection). |
k | Numeric. The number of observed variables collected at each wave. |
Time.complete | Numeric. Number of waves of data collection that have been completed before the funding cut occurs. |
costmx | A numeric vector containing the unit cost of each observed variable that is yet to be measured (post the funding cut). The cost is assumed to be constant across subjects, but it is allowed to vary across variables and across waves. |
pc | Numeric. Proportion of completers: the proportion of subjects that will participate in all of the following waves of data collection and provide complete data. This must be greater than 0. |
pd | Numeric. The proportion of subjects that will not participate in any of the following waves of data collection (i.e., people who will drop from the longitudinal study). This value can be 0. |
focal.param | Character vector. The parameters of focal interest.
The focal parameters should be specified in the format of
|
complete.var | Char vector. Specify the name(s) of the variable(s) if there are any variable(s) that need to have complete data collected from all the participating subjects. |
An object containing the information of the optimal missing data pattern containing only one missing observed variable. The optimal pattern is the one that yields highest statistical power for testing the focal parameters, compared to other patterns with only one missing observed variable.
simPM
which is a warpper function for this
function.