lassoSelect: Update lvnatLasso results to select a different model

Description Usage Arguments Author(s) Examples

View source: R/lassoSelect.R

Description

This function can be used to select a model using any fit index

Usage

1
lassoSelect(object, select, minimize = TRUE, refit = TRUE, lassoTol = 1e-04)

Arguments

object

An lvnetLasso object

select

A raw R expression using names used in the object$fitMeasures part of the output of lvnet

minimize

Logical. Minimize or maximize?

refit

Logical. Should the new best model be refitted.

lassoTol

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

Author(s)

Sacha Epskamp <[email protected]>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## 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:
res <- lvnetLasso(Data, "omega_theta", lambda = Lambda)
res$best
summary(res)

# Update to use EBIC:
resEBIC <- lassoSelect(res, ebic)
summary(resEBIC)

# Update to use minimal fitting model with RMSEA < 0.05:
resMinimal <- lassoSelect(res, df * (rmsea < 0.05), minimize = FALSE)
summary(resMinimal)

## End(Not run)

lvnet documentation built on Nov. 19, 2018, 1:04 a.m.