View source: R/generate_tirt_lavaan_syntax.R
| generate_tirt_lavaan_syntax | R Documentation |
Generates the syntax required to fit either a Second-Order Thurstonian Factor Model or a First-Order Thurstonian IRT Model in lavaan.
generate_tirt_lavaan_syntax(
n_blocks,
block_size,
key_matrix,
trait_col,
key_col,
cor_matrix = NULL,
model_type = c("TFM", "TIRT"),
force_positive_variances = TRUE,
more_constraints = ""
)
n_blocks |
Integer. Number of blocks in the questionnaire. |
block_size |
Integer. Number of items per block. |
key_matrix |
A data.frame indicating item trait and item sign. |
trait_col |
Character string. The name of the column in |
key_col |
Character string. The name of the column in |
cor_matrix |
Optional matrix. Starting values for trait correlations. |
model_type |
Character. Either "TFM" (Second-Order Thurstonian Factor Model) or "IRT" (First-Order). |
force_positive_variances |
Logical. If TRUE, prevents Heywood cases. In "Factor" models, utility variances > 0.0001. In "IRT" models, utility variances and derived correlated errors > 0.0001. Defaults to TRUE. |
more_constraints |
Additional lavaan syntax strings for constraining certain parameters if needed. |
A character string containing the lavaan model syntax.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.