A general implementation of Structural Equation Models with latent
variables (MLE, 2SLS, and composite likelihood estimators) with both
continuous, censored, and ordinal outcomes (Holst and Budtz-Joergensen
(2013) doi:10.1007/s00180-012-0344-y). Mixture latent variable models
and non-linear latent variable models (Holst and Budtz-Joergensen (2020)
doi:10.1093/biostatistics/kxy082). The package also provides methods
for graph exploration (d-separation, back-door criterion), simulation of
general non-linear latent variable models, and estimation of influence
functions for a broad range of statistical models.
To cite that lava package please use one of the following references
Klaus K. Holst and Esben Budtz-Joergensen (2013). Linear Latent
Variable Models: The lava-package. Computational Statistics 28 (4), pp
1385-1453. http://dx.doi.org/10.1007/s00180-012-0344-y
@article{lava,
title = {Linear Latent Variable Models: The lava-package},
author = {Klaus Kähler Holst and Esben Budtz-Jørgensen},
year = {2013},
volume = {28},
number = {4},
pages = {1385-1452},
journal = {Computational Statistics},
doi = {10.1007/s00180-012-0344-y}
}
Klaus K. Holst and Esben Budtz-Jørgensen (2020). A two-stage
estimation procedure for non-linear structural equation models.
Biostatistics 21 (4), pp 676-691.
http://dx.doi.org/10.1093/biostatistics/kxy082
@article{lava_nlin,
title = {A two-stage estimation procedure for non-linear structural equation models},
author = {Klaus Kähler Holst and Esben Budtz-Jørgensen},
journal = {Biostatistics},
year = {2020},
volume = {21},
number = {4},
pages = {676-691},
doi = {10.1093/biostatistics/kxy082},
}
Examples
Influence functions
Construct estimate objects from parameter coefficients and estimated
influence functions
a <- estimate(coef=c("a"=0.5), IC=rnorm(10), id=1:10)
b <- estimate(coef=c("b"=0.8), IC=rnorm(10), id=6:15)
Alternatively, we can construct estimate objects directly from an
existing model object (glm(), mets::phreg(), targeted::cate(), …)
estimate(modelobj, id, ...)
We can now merge the estimate objects to obtain their joint
distribution via their estimated influence functions
e <- c(a, b)
vcov(e) # joint distribution
#> a b
#> a 0.1023667491 0.0001747415
#> b 0.0001747415 0.0625808426
summary(e, null=c(0, 0))
#> Call: estimate.default(contrast = as.list(seq_along(p)), null = ..1,
#> vcov = vcov(object, messages = 0), coef = p)
#> ────────────────────────────────────────────────────────────
#> Estimate Std.Err 2.5% 97.5% P-value
#> a 0.5 0.3199 -0.1271 1.127 0.118111
#> b 0.8 0.2502 0.3097 1.290 0.001384
#> ────────────────────────────────────────────────────────────
#> Null Hypothesis:
#> [a] = 0
#> [b] = 0
#>
#> chisq = 12.6472, df = 2, p-value = 0.001793
Parameter transformations can be calculated directly as in the following
examples.
Products
a * b
#> Estimate Std.Err 2.5% 97.5% P-value
#> a 0.4 0.2851 -0.1588 0.9588 0.1607
lava)Latent Variable Models (
lava)A general implementation of Structural Equation Models with latent variables (MLE, 2SLS, and composite likelihood estimators) with both continuous, censored, and ordinal outcomes (Holst and Budtz-Joergensen (2013) doi:10.1007/s00180-012-0344-y). Mixture latent variable models and non-linear latent variable models (Holst and Budtz-Joergensen (2020) doi:10.1093/biostatistics/kxy082). The package also provides methods for graph exploration (d-separation, back-door criterion), simulation of general non-linear latent variable models, and estimation of influence functions for a broad range of statistical models.
Installation
For graphical capabilities the
Rgraphvizpackage is needed (first install theBiocManagerpackage)or the
igraphorvisNetworkpackagesThe development version of
lavamay also be installed directly fromgithub:Citation
To cite that
lavapackage please use one of the following referencesExamples
Influence functions
Construct
estimateobjects from parameter coefficients and estimated influence functionsAlternatively, we can construct estimate objects directly from an existing model object (
glm(),mets::phreg(),targeted::cate(), …)We can now merge the
estimateobjects to obtain their joint distribution via their estimated influence functionsParameter transformations can be calculated directly as in the following examples.
Products
General transformations
Inner product, sums, and products
Exponentiation and renaming of parameter
Transformation and subsetting
For the
%*%*operator we can also use a general contrast matrixStructural Equation Model
Specify structural equation models with two factors
Simulation
Estimation
Model assessment
Assessing goodness-of-fit, here the linearity between u2 and u1 (requires the
gofpackage)Non-linear measurement error model
Simulate non-linear model
Stage 1:
Stage 2
Simulation
Studying the small-sample properties of a mediation analysis
plot(m)
Simulate from model and estimate indirect effects
Add additional simulations and visualize results