plsem function

S3 interface for semi-confirmatory SEM via PL

S3 interface for semi-confirmatory SEM via PL

plsem() is an S3 interface for obaining a fitted lslx object.

plsem( model, data, penalty_method = "mcp", lambda_grid = "default", delta_grid = "default", numeric_variable, ordered_variable, weight_variable, auxiliary_variable, group_variable, reference_group, sample_cov, sample_mean, sample_size, sample_moment_acov, verbose = TRUE, ... )

Arguments

  • model: A character with length one to represent the model specification.
  • data: A data.frame of raw data. It must contains variables specified in model (and possibly the variables specified by group_variable and weight_variable).
  • penalty_method: A character to specify the penalty method. The current version supports "none", "lasso", "ridge", "elastic", and "mcp".
  • lambda_grid: A non-negative numeric to specify penalty levels for both "lasso" and "mcp". If it is set as "default", its value will be generated automatically based on the variable scales.
  • delta_grid: A non-negative numeric to specify the convexity level for "mcp". If it is set as "default", its value will be generated automatically based on the variable scales.
  • numeric_variable: A character to specify which response variables should be transfromed into numeric.
  • ordered_variable: A character to specify which response variables should be transfromed into ordered.
  • weight_variable: A character with length one to specify what variable is used for sampling weight.
  • auxiliary_variable: A character to specify what variable(s) is used as auxiliary variable(s) for estimating saturated moments when missing data presents and two-step method is implemented. Auxiliary variable(s) must be numeric. If any categorical auxiliary is considered, please transform it into dummy variables before initialization.
  • group_variable: A character with length one to specify what variable is used for labeling group.
  • reference_group: A character with length one to specify which group is set as reference.
  • sample_cov: A numeric matrix (single group case) or a list of numeric matrix (multi-group case) to represent sample covariance matrixs. It must have row and column names that match the variable names specified in model.
  • sample_mean: A numeric (single group case) or a list of numeric (multi-group case) to represent sample mean vectors.
  • sample_size: A numeric (single group case) with length one or a list of numeric (multi-group case) to represent the sample sizes.
  • sample_moment_acov: A numeric matrix (single group case) or a list of numeric matrix (multi-group case) to represent asymptotic covariance for moments.
  • verbose: A logical to specify whether messages made by lslx should be printed.
  • ...: Other arguments. For details, please see the documentation of lslx.

Returns

A fitted lslx object

Examples

## EXAMPLE: Semi-Confirmatory Factor Analysis with lavaan Style ## # specify a factor analysis model with lavaan style model_fa <- "visual =~ x1 + x2 + x3 textual =~ x4 + x5 + x6 speed =~ x7 + x8 + x9 pen() * visual =~ x4 + x5 + x6 + x7 + x8 + x9 pen() * textual =~ x1 + x2 + x3 + x7 + x8 + x9 pen() * speed =~ x1 + x2 + x3 + x4 + x5 + x6 visual ~~ 1 * visual textual ~~ 1 * textual speed ~~ 1 * speed" # fit with mcp under specified penalty levels and convexity levels lslx_fa <- plsem(model = model_fa, data = lavaan::HolzingerSwineford1939, penalty_method = "mcp", lambda_grid = seq(.02, .60, .02), delta_grid = c(1.5, 3.0, Inf)) # summarize fitting result under the penalty level selected by 'bic' summary(lslx_fa, selector = "bic")
  • Maintainer: Po-Hsien Huang
  • License: GPL-3
  • Last published: 2022-12-02