lvnet: Confirmatory Latent Variable Network Models

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

This function utilizes OpenMx (Boker et al., 2011, 2014) to confirmatory test latent variable network models between P manifests and M latents. See the details section for information about the modeling framework used. All the input matrices can be assigned R matrices with numbers indicating fixed values and NA indicating a value is free to estimate.

Usage

1
2
3
4
lvnet(data, lambda, beta, omega_theta, delta_theta, omega_psi, delta_psi, psi, theta, 
        sampleSize, fitInd, fitSat, startValues = list(), scale = FALSE, nLatents,
        lasso = 0,  lassoMatrix, lassoTol = 1e-4, ebicTuning = 0.5, 
        mimic = c("lavaan","lvnet"), fitFunction = c("penalizedML", "ML"), exogenous)

Arguments

data

An N (sample size) x P matrix or data frame containing the raw data, or a P x P variance-covariance matrix.

lambda

A P x M matrix indicating factor loadings. Defaults to a full NA P x M matrix if psi or omega_psi is not missing, or a P x 0 dummy matrix.

beta

An M x M matrix indicating linear effects between latent variables. Defaults to an M x M matrix containing only zeroes.

omega_theta

A P x P matrix encoding the residual network structure. By default, theta is modeled instead.

delta_theta

A P x P diagonal scaling matrix. Defaults to NA on all diagonal elements. Only used if omega_theta is modeled.

omega_psi

An M x M matrix containing the latent network structure. Dy default, psi is modeled instead.

delta_psi

A diagonal M x M scaling matrix. Defaults to an identity matrix. Only used if omega_psi is modeled.

psi

An M x M variance-covariance matrix between latents and latent residuals. Defaults to a full NA matrix.

theta

A P x P variance-covariance matrix of residuals of the observed variables. Defaults to a diagonal matrix containing NAs

sampleSize

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

fitInd

The fit of the independence model. Used to speed up estimation fitting multiple models.

fitSat

The fit of the saturated model. Used to speed up estimation fitting multiple models.

startValues

An optional named list containing starting values of each model. e.g., list(lambda = matrix(1,9,3)) would set the starting values of a 10 x 3 lambda matrix to ones.

scale

Logical, should data be standardized before running lvnet?

nLatents

The number of latents. Allows for quick specification when lambda is missing. Not needed is lambda is assigned.

lasso

The LASSO tuning parameter.

lassoMatrix

Character vector indicating the names of matrices to apply LASSO regularization on. e.g., "omega_psi" or "omega_theta".

lassoTol

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

ebicTuning

Tuning parameter used in extended Bayesian Information Criterion.

mimic

If set to "lavaan" (default), covariance matrix is rescaled and N is used rather than N - 1 in likelihood computation.

fitFunction

The fit function to be used. penalizedML will fit the penalized fit function and ML the maximum likelihood function.

exogenous

Numeric vector indicating which variables are exogenous.

Details

The modeling framework follows the all-y LISREL framework for Structural Equation Models (SEM; Hayduk, 1987) to model relationships between P observed variables and M latent variables:

sigma = lambda * (I - beta)^(-1) psi (I - beta)^(-1 T) * lambda^T + theta

Where Sigma is the P x P model-implied covariance matrix, lambda a P x M matrix of factor loadings, B an M x M matrix containing regression effects between latent variables, Psi a M x M covariance matrix of the latent variables/residuals and Theta a P x P covariance matrix of residuals of the observed indicators.

The lvnet function allows for two extensions of this modeling framework. First, psi can be chosen to be modeled as follows:

psi = delta_psi (I - omega_psi)^(-1) delta_psi

In which delta_psi is a M x M diagonal scaling matrix and omega_psi a M x M matrix containing zeroes on the diagonal and partial correlation coefficients on the offdiagonal values of two latent variables conditioned on all other latent variables. omega_psi therefore corresponds to a Gaussian Graphical Model, or a network structure.

Similarly, theta can be chosen to be modeled as follows:

theta = delta_theta (I - omega_theta)^(-1) delta_theta

In which delta_theta is a P x P diagonal scaling matrix and omega_theta a P x P matrix containing zeroes on the diagonal and partial correlation coefficients on the offdiagonal values of two residuals conditioned on all other residuals.

Modeling omega_psi is termed Latent Network Modeling (LNM) and modeling omega_theta is termed Residual Network Modeling (RNM). lvnet automatically chooses the appropriate modeling framework based on the input.

Value

An lvnet object, which is a list containing the following elements:

matrices

A list containing thee estimated model matrices

sampleStats

A list containing the covariance matrix (covMat) and sample size sampleSize

mxResults

The OpenMx object of the fitted model

fitMeasures

A named list containing the fit measures of the fitted model

Author(s)

Sacha Epskamp <mail@sachaepskamp.com>

References

Boker, S. M., Neale, M., Maes, H., Wilde, M., Spiegel, M., Brick, T., ... Fox, J. (2011). OpenMx: an open source extended structural equation modelingframework. Psychometrika, 76(2), 306-317

Boker, S. M., Neale, M. C., Maes, H. H., Wilde, M. J., Spiegel, M., Brick, T. R., ..., Team OpenMx. (2014). Openmx 2.0 user guide [Computer software manual].

Hayduk, L. A. (1987).Structural equation modeling with LISREL: Essentials advances. Baltimore, MD, USA: Johns Hopkins University Press.

See Also

lvnetSearch

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
27
28
29
30
31
32
# 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

# Fit CFA model:
CFA <- lvnet(Data, lambda = Lambda)

# Latent network:
Omega_psi <- matrix(c(
  0,NA,NA,
  NA,0,0,
  NA,0,0
),3,3,byrow=TRUE)

# Fit model:
LNM <- lvnet(Data, lambda = Lambda, omega_psi=Omega_psi)

# Compare fit:
lvnetCompare(cfa=CFA,lnm=LNM)

# Summary:
summary(LNM)

# Plot latents:
plot(LNM, "factorStructure")

Example output

Loading required package: OpenMx
To take full advantage of multiple cores, use:
  mxOption(NULL, 'Number of Threads', parallel::detectCores())
This is lavaan 0.5-23.1097
lavaan is BETA software! Please report any bugs.

Attaching package: 'lavaan'

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

    vech

sh: 1: cannot create /dev/null: Permission denied
sh: 1: wc: Permission denied
          Df      AIC      BIC     EBIC    Chisq Chisq diff Df diff
Saturated  0       NA       NA       NA  0.00000         NA      NA
cfa       24 7517.490 7595.339 7835.038 85.30552  85.305522      24
lnm       25 7516.494 7590.637 7818.921 86.31009   1.004565       1
            Pr(>Chisq)
Saturated           NA
cfa       8.502553e-09
lnm       3.162085e-01
========== lvnet ANALYSIS RESULTS ========== 

Input: 
	Model:			 
	Number of manifests:	 9 
	Number of latents:	 3 
	Number of parameters:	 20 
	Number of observations	 301

Test for exact fit: 
	Chi-square:		 86.31 
	DF:			 25 
	p-value:		 0

Information criteria: 
	AIC:			 7516.494 
	BIC:			 7590.637 
	Adjusted BIC:		 7527.208 
	Extended BIC:		 7818.921

Fit indices: 
	CFI:			 0.931 
	NFI:			 0.906 
	TLI:			 0.9 
	RFI:			 0.865 
	IFI:			 0.931 
	RNI:			 0.931 
	RMR:			 0.077 
	SRMR:			 0.061

RMSEA: 
	RMSEA:			 0.09 
	90% CI lower bound:	 0.07 
	90% CI upper bound:	 0.111 
	p-value:		 0.001

Parameter estimates:
    matrix row col          name Estimate
    lambda   1   1    lambda_1_1    0.708
    lambda   2   1    lambda_2_1    0.393
    lambda   3   1    lambda_3_1    0.517
    lambda   4   2    lambda_4_2    0.874
    lambda   5   2    lambda_5_2    0.971
    lambda   6   2    lambda_6_2    0.809
    lambda   7   3    lambda_7_3    0.537
    lambda   8   3    lambda_8_3    0.639
    lambda   9   3    lambda_9_3    0.587
     theta   1   1     theta_1_1    0.559
     theta   2   2     theta_2_2    1.135
     theta   3   3     theta_3_3    0.848
     theta   4   4     theta_4_4    0.370
     theta   5   5     theta_5_5    0.448
     theta   6   6     theta_6_6    0.356
     theta   7   7     theta_7_7    0.805
     theta   8   8     theta_8_8    0.487
     theta   9   9     theta_9_9    0.563
 omega_psi   1   2 omega_psi_1_2    0.422
 omega_psi   1   3 omega_psi_1_3    0.442

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

Related to lvnet in lvnet...