make_mplus_gpcm_model_syntax: Preparing Mplus code to estimate RS models

View source: R/resp_styles_to_mplus.R

make_mplus_gpcm_model_syntaxR Documentation

Preparing Mplus code to estimate RS models

Description

Prepares components of Mplus model description syntax for a GPCM (NRM).

Usage

make_mplus_gpcm_model_syntax(
  data,
  items,
  scoringMatrix,
  observedExogenous = vector(mode = "character", length = 0L),
  observedDependent = vector(mode = "character", length = 0L),
  fixSlopes = vector(mode = "character", length = 0L),
  reverseCoded = vector(mode = "list", length = 0L),
  orthogonal = vector(mode = "character", length = 0L),
  weight = NA_character_,
  output = "STDYX",
  savedata = NA_character_,
  analysis = list(ESTIMATOR = "MLR", ALGORITHM = "INTEGRATION", INTEGRATION = "STANDARD",
    PROCESSORS = "4"),
  title = "Some GPCM model with custom scoring matrix"
)

Arguments

data

a data frame

items

a character vector of item names or a list describing items matching to latent traits in a between-item multidimensional model; in the latter case list elements must be named after column names of the scoringMatrix with each element being a list describing different latent traits that should be scored using a given column of the scoringMatrix; names of these second-level elements specify names of latent traits and elements themselves are character vectors of item names that are assigned to (loaded) a given latent trait

scoringMatrix

a matrix describing how responses (described in rownames of the matrix) map on scores of latent traits (described in columns of the matrix)

observedExogenous

either:

  • a character vector with names of observed exogenous predictors that should be used to predict latent variables in the model

  • a matrix with latent traits in columns and observed exogenous predictors in rows specifying which of the exogenous predictors should be used to predict which latent traits (matrix should contain only 0 and 1 or TRUE and FALSE)

observedDependent

either:

  • a character vector with names of observed dependent variables that should be predicted using latent variables in the model

  • a matrix with latent traits in columns and observed dependent variables in rows specifying which of the dependent variables should be predicted by which latent traits (matrix should contain only 0 and 1 or TRUE and FALSE)

fixSlopes

optionally a character vector of latent trait names for which item slopes parameters should be fixed across items (these names need to occur in column names of scoringMatrix)

reverseCoded

optionally a named list of character vectors with names of list elements specifying latent trait names and elements giving names of items that are reverse coded with respect to this latent trait; please note, that these don't need to be given if slopes of the no-RS trait(s) are not fixed across items

orthogonal

optionally a character vector of latent trait names indicating which latent traits should be specified as orthogonal to each other (all the mentioned latent traits will be specified as orthogonal to each other and all the other latent traits)

weight

optionally a string with a name of the variable storing weights

output

optionally a character vector of Mplus options defining what type of results should be included in the output

savedata

optionally a string with a name of the file in which factor scores should be saved

analysis

a list with elements ESTIMATOR, ALGORITHM, INTEGRATION and PROCESSORS containing Mplus ANALYSIS options (provided as strings)

title

string with a title for the analysis

Details

For the description of model specification see Details section in make_mplus_gpcm_vmmc_syntax

Value

A list with elements named TITLE, VARIABLE, ANALYSIS, MODEL, MODELCONSTRAINT, SAVEDATA, rdata, usevariables that can be used as arguments to the mplusObject function from the package MplusAutomation using do.call

Limitations

At the moment there is no possibility to prepare models with many no-RS latent traits loading different sets of items.


tzoltak/rstyles documentation built on Dec. 4, 2024, 5:16 p.m.