Learn R Programming

lvnet (version 0.3.5)

lvnetLasso: LASSO model selection

Description

This function runs lvnet for a number of different tuning parameters, selects the best model based on some criterion and refits that model to obtain accurate parameter estimates. The lassoSelect function can afterwards be used to select a different model.

Usage

lvnetLasso(data, lassoMatrix, lassoTol = 1e-04, nTuning = 20, 
  tuning.min = 0.01, tuning.max = 0.5, criterion = c("bic", "aic", 
  "ebic"), verbose = TRUE, refitFinal = TRUE, refitAll = FALSE, 
  nCores = 1, ...)

Arguments

data

The data argument as used in lvnet

lassoMatrix

Vector indicating the matrix or matrices to use in LASSO optmimization

lassoTol

Tolerance for absolute values to be treated as zero in counting parameters.

nTuning

Number of tuning parameters to estimate.

tuning.min

Minimal tuning parameter

tuning.max

Maximal tuning parameter

criterion

Criterion to use in model selection

verbose

Should progress be printed to the console?

refitFinal

Logical, should the best fitting model be refitted without LASSO regularization?

refitAll

Logical, should *all* models be refitted without LASSO regularization (but with zeroes constrained) before evaluating fit criterium?

nCores

Number of cores to use in parallel computing.

Arguments sent to lvnet

Examples

Run this code
# NOT RUN {
# Load dataset:
library("lavaan")
data(HolzingerSwineford1939)
Data <- HolzingerSwineford1939[,7:15]

# Measurement model:
Lambda <- matrix(0, 9, 3)
Lambda[1:3,1] <- NA
Lambda[4:6,2] <- NA
Lambda[7:9,3] <- NA

# Search best fitting omega_theta:
# }
# NOT RUN {
res <- lvnetLasso(Data, "omega_theta", lambda = Lambda)
res$best
summary(res)
# }

Run the code above in your browser using DataLab