dot-regularizeSEMWithCustomPenaltyRsolnp: .regularizeSEMWithCustomPenaltyRsolnp

.regularizeSEMWithCustomPenaltyRsolnpR Documentation

.regularizeSEMWithCustomPenaltyRsolnp

Description

Optimize a SEM with custom penalty function using the Rsolnp optimizer (see ?Rsolnp::solnp). This optimizer is the default in regsem (see ?regsem::cv_regsem).

Usage

.regularizeSEMWithCustomPenaltyRsolnp(
  lavaanModel,
  individualPenaltyFunction,
  tuningParameters,
  penaltyFunctionArguments,
  startingValues = "est",
  carryOverParameters = TRUE,
  control = list(trace = 0)
)

Arguments

lavaanModel

model of class lavaan

individualPenaltyFunction

penalty function which takes the current parameter values as first argument, the tuning parameters as second, and the penaltyFunctionArguments as third argument and returns a single value - the value of the penalty function for a single person. If the true penalty function is non-differentiable (e.g., lasso) a smooth approximation of this function should be provided.

tuningParameters

data.frame with tuning parameter values. Important: The function will iterate over the rows of these tuning parameters and pass them to your penalty function

penaltyFunctionArguments

arguments passed to individualPenaltyFunction, individualPenaltyFunctionGradient, and individualPenaltyFunctionHessian

startingValues

option to provide initial starting values. Only used for the first lambda. Three options are supported. Setting to "est" will use the estimates from the lavaan model object. Setting to "start" will use the starting values of the lavaan model. Finally, a labeled vector with parameter values can be passed to the function which will then be used as starting values.

carryOverParameters

should parameters from the previous iteration be used as starting values of the next iteration?

control

option to set parameters of the optimizer; see ?Rsolnp::solnp

Value

Model of class regularizedSEMWithCustomPenalty


lessSEM documentation built on May 29, 2024, 7:10 a.m.