Estimate parameters for profiles for a specific solution (requires purchasing and installing MPlus to use)

estimate_profiles_mplus(df, ..., latent_vars = NULL, n_profiles,
  idvar = NULL, data_filename = "d.dat", script_filename = "i.inp",
  output_filename = "i.out", savedata_filename = "d-mod.dat",
  variances = "equal", covariances = "zero", model = NULL,
  starts = c(100, 10), m_iterations = 500, st_iterations = 20,
  convergence_criterion = 1e-06, remove_tmp_files = TRUE,
  print_input_file = FALSE, return_save_data = TRUE, optseed = NULL,
  n_processors = 1, cluster_ID = NULL, include_VLMR = TRUE,
  include_BLRT = FALSE, return_all_stats = FALSE)

Arguments

df

data.frame with two or more columns with continuous variables

...

unquoted variable names separated by commas

latent_vars

defaults to NULL; specification for the latent varibles as a list, i.e. list(beh = c(1, 2), cog = c(3, 4), aff = (5, 6)), where the integers represent the position of the variables passed to the function and how they correspond to the latent variables, which are named

n_profiles

the number of profiles (or mixture components) to be estimated

idvar

optional name of the column to be used as the ID variable (should be supplied as a string). Defaults to NULL, in which case row numbers will be used. Note the ID can be numeric or string, but must be unique.

data_filename

name of data file to prepare; defaults to d.dat

script_filename

name of script to prepare; defaults to i.inp

output_filename

name of the output; defaults to o.out

savedata_filename

name of the output for the save data (with the original data conditional probabilities); defaults to o-mod.out

variances

how the variable variances are estimated; defaults to "equal" (to be constant across profiles); other option is "varying" (to be varying across profiles)

covariances

how the variable covariances are estimated; defaults to "zero" (to not be estimated, i.e. for the covariance matrix to be diagonal); other options are "varying" (to be varying across profiles) and "equal" (to be constant across profiles)

model

which model to estimate (DEPRECATED; use variances and covariances instead)

starts

number of initial stage starts and number of final stage optimizations; defaults to c(20, 4); can be set to be more conservative to c(500, 50)

m_iterations

number of iterations for the EM algorithm; defaults to 500

st_iterations

the number of initial stage iterations; defaults to 10; can be set more to be more conservative to 50

convergence_criterion

convergence criterion for the Quasi-Newton algorithm for continuous outcomes; defaults to 1E-6 (.000001); can be set more conservatively to 1E-7 (.0000001)

remove_tmp_files

whether to remove data, script, and output files; defaults to TRUE

print_input_file

whether to print the input file to the console

return_save_data

whether to return the save data (with the original data and the posterior probabilities for the classes and the class assignment) as a data.frame along with the MPlus output; defaults to TRUE

optseed

random seed for analysis

n_processors

= 1

cluster_ID

clustering variable (i.e., if data are from students clustered into distinct classrooms) to be used as cluster variables as part of the type = complex option

include_VLMR

whether to include the Vu-Lo-Mendell-Rubin likelihood-ratio test; defaults to TRUE

include_BLRT

whether to include the bootstrapped LRT; defaults to FALSE because of the time this takes to run

return_all_stats

defaults to FALSE; if TRUE, returns as a one-row data frame all of the statistics returned from compare_solutions_mplus()

Value

either a tibble or a ggplot2 plot of the BIC values for the explored models

Details

Creates an mplus model (.inp) and associated data file (.dat)

Examples

# NOT RUN {
m <- estimate_profiles_mplus(iris,
                            Sepal.Length, Sepal.Width, Petal.Length, Petal.Width,
                            n_profiles = 2)
# }