lvnetSearch {lvnet} | R Documentation |
Step-wise exploratory search for optimal fitting model
Description
Performs stepwise search to optimize the structure of omega_theta, omega_psi, theta or psi. Starts at empty or full structure and iteratively adds or removes edges to optimize the criterion.
Usage
lvnetSearch(data, matrix = c("omega_theta", "omega_psi", "theta", "psi"),
criterion = c("bic", "ebic","chisq","aic"),
start = c("default","empty","full"), alpha = 0.05, lambda, sampleSize,
maxIter, nCores = 1, maxChange = 1, ..., verbose = TRUE, file,
startValues = list())
Arguments
data |
The data argument as used in |
matrix |
Character string indicating the matrix to be optimized. Can be |
criterion |
Character string indicating the criterion to be used. |
start |
A character string indicating the structure of the matrix at the start of the algorithm. |
alpha |
The alpha level for chi-square significance testing. |
lambda |
The lambda argument as used in |
sampleSize |
The sample size, only used if |
maxIter |
The maximum number of edges to test. Defaults to M(M-1)/2 |
nCores |
Number of cores to use in parallel estimation. |
maxChange |
Set to higher than one to change multiple edges in each run. Each iteration, maxChange is reset to max(number of changed edges - 1, 1). Can result in instable results when searching |
... |
Arguments sent to |
verbose |
Logical if progress should be printed to the consile. |
file |
An optional character string containing a file name to store temporary results in. |
startValues |
A list containing start values as used in |
Value
An object of class lvnetSearch
, which is a list containing:
best |
The |
modList |
A list containing the chain of fitted models |
niter |
The number of iterations used |
Author(s)
Sacha Epskamp <mail@sachaepskamp.com>
See Also
Examples
# 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_psi:
## Not run:
res <- lvnetSearch(Data, "omega_psi", lambda = Lambda)
res$best
## End(Not run)