lvnetSearch: Step-wise exploratory search for optimal fitting model

Description Usage Arguments Value Author(s) See Also Examples

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

1
2
3
4
5
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 lvnet

matrix

Character string indicating the matrix to be optimized. Can be "omega_theta", "omega_psi", "theta" and "psi".

criterion

Character string indicating the criterion to be used. "AIC" and "BIC" optimize the AIC or BIC respectively, and "chisq" performs chi-square tests to see if adding an edge significantly improves model fit or removing an edges does not significantly reduce model fit.

start

A character string indicating the structure of the matrix at the start of the algorithm. "empty" starts with a matrix with only zeroes and "full" starts with a matrix in which all elements are free to estimate. "lvglasso" employs the lvglasso algorithm (EBIClvglasso to find a starting structure for omega_theta and "glasso" employs the glasso algorithm to find a starting point for omega_psi (EBICglasso). "default" will lead to a full matrix if omega_psi or psi is optimized, and an empty matrix if omega_theta or theta is optimized.

alpha

The alpha level for chi-square significance testing.

lambda

The lambda argument as used in lvnet

sampleSize

The sample size, only used if data is a covariance matrix.

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 "omega_theta".

...

Arguments sent to lvnet

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 lvnet

Value

An object of class lvnetSearch, which is a list containing:

best

The lvnet object of the best fitting model

modList

A list containing the chain of fitted models

niter

The number of iterations used

Author(s)

Sacha Epskamp <mail@sachaepskamp.com>

See Also

lvnet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 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)

Example output

Loading required package: OpenMx
To take full advantage of multiple cores, use:
  mxOption(NULL, 'Number of Threads', parallel::detectCores()) #now
  Sys.setenv(OMP_NUM_THREADS=parallel::detectCores()) #before library(OpenMx)
This is lavaan 0.6-3
lavaan is BETA software! Please report any bugs.

Attaching package: 'lavaan'

The following object is masked from 'package:OpenMx':

    vech

Estimating initial lvnet model
sh: 1: wc: Permission denied
sh: 1: cannot create /dev/null: Permission denied

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |======================================================================| 100%
Changing 1 edge

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |======================================================================| 100%

lvnet estimation completed.:
 	- Chi-square (25) = 86.31, p = 0
 	- RMSEA = 0.09 (95% CI: 0.07 - 0.11)

 Use summary(object) to inspect more fitmeasures and parameter estimates (see ?summary.lvnet) 
 Use plot(object) to plot estimated networks and factor structures (see ?plot.lvnet) 
 Use lvnetCompare(object1, object2) to compare lvnet models (see ?lvnetCompare)

lvnet documentation built on June 21, 2019, 9:06 a.m.

Related to lvnetSearch in lvnet...