PenalisedOpenMx {sharp}R Documentation

Penalised Structural Equation Model

Description

Runs penalised Structural Equation Modelling using implementations from OpenMx functions (for PenalisedOpenMx), or using series of penalised regressions with glmnet (for PenalisedLinearSystem). The function PenalisedLinearSystem does not accommodate latent variables. These functions are not using stability.

Usage

PenalisedOpenMx(
  xdata,
  adjacency,
  penalised = NULL,
  residual_covariance = NULL,
  Lambda,
  ...
)

PenalisedLinearSystem(xdata, adjacency, penalised = NULL, Lambda = NULL, ...)

Arguments

xdata

matrix with observations as rows and variables as columns. Column names must be defined and in line with the row and column names of adjacency.

adjacency

binary adjacency matrix of the Directed Acyclic Graph (transpose of the asymmetric matrix A in Reticular Action Model notation). The row and column names of this matrix must be defined.

penalised

optional binary matrix indicating which coefficients are regularised.

residual_covariance

binary and symmetric matrix encoding the nonzero entries in the residual covariance matrix (symmetric matrix S in Reticular Action Model notation). By default, this is the identity matrix (no residual covariance).

Lambda

matrix of parameters controlling the level of sparsity. Only the minimum, maximum and length are used in PenalisedOpenMx.

...

additional parameters passed to OpenMx functions (for PenalisedOpenMx), or glmnet (for PenalisedLinearSystem).

Value

A list with:

selected

matrix of binary selection status. Rows correspond to different regularisation parameters. Columns correspond to different parameters to estimated.

beta_full

matrix of model coefficients. Rows correspond to different regularisation parameters. Columns correspond to different parameters to estimated.

References

Jacobucci R, Grimm KJ, McArdle JJ (2016). “Regularized structural equation modeling.” Structural equation modeling: a multidisciplinary journal, 23(4), 555–566. doi:10.1080/10705511.2016.1154793.

See Also

SelectionAlgo, VariableSelection, OpenMxMatrix, LinearSystemMatrix

Other underlying algorithm functions: CART(), ClusteringAlgo(), PenalisedGraphical(), PenalisedRegression()

Examples


# Data simulation
pk <- c(3, 2, 3)
dag <- LayeredDAG(layers = pk)
theta <- dag
theta[2, 4] <- 0
set.seed(1)
simul <- SimulateStructural(theta = theta, pk = pk, output_matrices = TRUE)

# Running regularised SEM (OpenMx)
if (requireNamespace("OpenMx", quietly = TRUE)) {
  mysem <- PenalisedOpenMx(
    xdata = simul$data, adjacency = dag,
    Lambda = seq(1, 10, 1)
  )
  OpenMxMatrix(vect = mysem$selected[3, ], adjacency = dag)
}

# Running regularised SEM (glmnet)
mysem <- PenalisedLinearSystem(
  xdata = simul$data, adjacency = dag
)
LinearSystemMatrix(vect = mysem$selected[20, ], adjacency = dag)


[Package sharp version 1.4.6 Index]