Package: lava 1.8.0

lava: Latent Variable Models

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.

Authors:Klaus K. Holst [aut, cre], Brice Ozenne [ctb], Thomas Gerds [ctb]

lava_1.8.0.tar.gz
lava_1.8.0.zip(r-4.5)lava_1.8.0.zip(r-4.4)lava_1.8.0.zip(r-4.3)
lava_1.8.0.tgz(r-4.4-any)lava_1.8.0.tgz(r-4.3-any)
lava_1.8.0.tar.gz(r-4.5-noble)lava_1.8.0.tar.gz(r-4.4-noble)
lava_1.8.0.tgz(r-4.4-emscripten)lava_1.8.0.tgz(r-4.3-emscripten)
lava.pdf |lava.html
lava/json (API)
NEWS

# Install 'lava' in R:
install.packages('lava', repos = c('https://kkholst.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/kkholst/lava/issues

Datasets:

On CRAN:

latent-variable-modelssimulationstatisticsstructural-equation-models

14.89 score 33 stars 449 packages 618 scripts 147k downloads 4 mentions 257 exports 14 dependencies

Last updated 9 months agofrom:35f308aa10. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 20 2024
R-4.5-winOKNov 20 2024
R-4.5-linuxOKNov 20 2024
R-4.4-winOKNov 20 2024
R-4.4-macOKNov 20 2024
R-4.3-winOKNov 20 2024
R-4.3-macOKNov 20 2024

Exports:%++%%in.closed%%in.open%%ni%aalenExponential.lvmaddattraddhookaddvaraddvar<-adjMatancestorsas.simbackdoorbaptizebeta.lvmbinary.lvmBinary.lvmbinomial.lvmbinomial.rdbinomial.rrblockdiagbootstrapBycancelcancel<-categoricalcategorical<-childrenchisq.lvmclickclosed.testingCoefMatCoefMat.multigroupfitColcolorbarcolselCombinecommutationcomparecomplikconfbandconfpredconstant.lvmconstrainconstrain<-constraintscontrcorrelationcovariancecovariance<-covfixcovfix<-coxExponential.lvmcoxGompertz.lvmcoxWeibull.lvmcsplitcurlydecomp.specialsdensity.simdescendantsdescribecoefdevcoordsdiagtestDiffdistributiondistribution<-dmvn0dsepedgelabelsedgelabels<-edgeListendogenousequivalenceestimateestimate.defaulteventTimeeventTime<-exogenousexogenous<-Expandexpitfinalizefixsomefoldrforestplotfplotfunctionalfunctional<-Gamma.lvmgaussian_logLik.lvmgaussian.lvmgethookgetMplusgetoutcomegetSASgkgammaGM2.lvmGM3.lvmgofGraphGraph<-graph2lvmGrepheavytailheavytail<-ICid.lvmIdenticalidplotigraph.lvmiidimagesindexindex<-informationinterceptintercept<-interventionintervention<-intfixintfix<-InverseIVkillkill<-ksmooth2labels<-latentlatent<-lavalava.optionsloggamma.lvmlogitlogit.lvmlognormal.lvmlvmmakemissingmanifestmeasurementmeasurement.errorMissingMissing<-mixtureModelModel<-modelParmodelsearchmodelVarmomentsmultigroupmultinomialmultinomial.lvmmvn.lvmmvnmixna.pass0NA2xnodecolor<-none.lvmnonlinearnonlinear<-normal.lvmNRoddsoffdiagoffdiag<-offdiagsones.lvmORordinalordinal<-ordregp.correctpairwise.diffparameterparameter<-parentspareto.lvmparfixparfix<-parlabelsparposparsparsedesignpartialcorpathpcorPDpdfconvertplot_regionplot.simplotConfpoisson.lvmpredictlvmPrintprobit.lvmprocformularandomsloperandomslope<-Range.lvmRatioregfixregfix<-regressionregression<-reindexrevdiagrevdiag<-riskcomprmvarrmvar<-rmvn0rootsrot2Drot3Drotate2rsqscheffescoreSequence.lvmsimsinksspaghettiSpecialsstarter.multigroupstartvaluesstartvalues0startvalues1startvalues2student.lvmsummary.simsurfacethreshold.lvmtigoltimedeptimedep<-toformulatotaleffectstrtransform<-trimtwostagetwostageCVuniform.lvmupdatelvmvar_icvariancevariance<-variancesvarsvecwaitweibull.lvmWeightswkmwrapvecx2NAzibreg

Dependencies:clicodetoolsdigestfuturefuture.applyglobalslatticelistenvMatrixnumDerivparallellyprogressrSQUAREMsurvival

Estimating partial correlations with lava

Rendered fromcorrelation.Rmdusingknitr::rmarkdownon Nov 20 2024.

Last update: 2023-12-20
Started: 2020-05-23

Non-linear latent variable models and error-in-variable models

Rendered fromnonlinear.Rmdusingknitr::rmarkdownon Nov 20 2024.

Last update: 2023-11-20
Started: 2020-05-23

The Art of Influence

Rendered frominfluencefunction.Rmdusingknitr::rmarkdownon Nov 20 2024.

Last update: 2023-12-20
Started: 2023-11-15

Readme and manuals

Help Manual

Help pageTopics
Estimation and simulation of latent variable modelslava-package lava
Concatenation operator%++%
Matching operator (x not in y) oposed to the '%in%'-operator (x in y)%in.closed% %in.open% %ni%
Add variable to (model) objectaddvar addvar<-
Backdoor criterionbackdoor
Label elements of objectbaptize
Define constant risk difference or relative risk association for binary exposurebinomial.rd binomial.rr
Combine matrices to block diagonal structureblockdiag
Longitudinal Bone Mineral Density Data (Wide format)bmd
Databmidata
Generic bootstrap methodbootstrap
Calculate bootstrap estimates of a lvm objectbootstrap.lvm bootstrap.lvmfit
Simulated databrisa
Apply a Function to a Data Frame Split by FactorsBy
Longitudinal Bone Mineral Density Datacalcium
Generic cancel methodcancel cancel<-
Extract children or parent elements of objectadjMat ancestors children descendants edgeList parents roots sinks
Identify points on plotclick click.default colsel idplot
Closed testing procedureclosed.testing p.correct
Generate a transparent RGB colorCol
Add color-bar to plotcolorbar
Report estimates across different modelsCombine
Finds the unique commutation matrixcommutation
Statistical testscompare
Composite Likelihood for probit latent variable modelscomplik
Add Confidence limits bar to plotconfband forestplot plot_region
Calculate confidence limits for parametersconfint.lvmfit confint.multigroupfit
Conformal predictionconfpred
Add non-linear constraints to latent variable modelconstrain constrain.default constrain<- constrain<-.default constrain<-.multigroup constraints parameter<-
Create contrast matrixcontr pairwise.diff parsedesign
Generic method for extracting correlation coefficients of model objectcorrelation
Add covariance structure to Latent Variable Modelcovariance covariance.lvm covariance<- covariance<-.lvm covfix covfix.lvm covfix<- covfix<-.lvm variance variance.lvm variance<- variance<-.lvm
Split data into foldscsplit foldr
Adds curly brackets to plotcurly
Returns device-coordinates and plot-regiondevcoords
Calculate diagnostic tests for 2x2 tablediagtest Diff odds OR Ratio riskcomp
Check d-separation criteriondsep dsep.lvm
Identify candidates of equivalent modelsequivalence
Estimate parameters and influence function.estimate.array estimate.data.frame
Estimation of functional of parametersestimate estimate.default estimate.estimate estimate.mlm merge.estimate
Estimation of parameters in a Latent Variable Model (lvm)estimate.lvm
Add an observed event time outcome to a latent variable model.eventTime eventTime<-
Create a Data Frame from All Combinations of FactorsExpand
fplotfplot
Read Mplus outputgetMplus
Read SAS outputgetSAS
Extract model summaries and GOF statistics for model objectgof gof.lvmfit information information.lvmfit logLik.lvmfit moments moments.lvm score score.lvmfit
Extract graphGraph Graph<-
Finds elements in vector or column-names in data.frame/matrixGrep
Hubble datahubble
Hubble datahubble2
Extract i.i.d. decomposition (influence function) from model objectIC IC.default var_ic
Extract i.i.d. decomposition from model objectiid
Organize several image calls (for visualizing categorical data)images
Dataindoorenv
Fix mean parameters in 'lvm'-objectintercept intercept.lvm intercept<- intercept<-.lvm intfix intfix.lvm intfix<- intfix<-.lvm
Define interventionintervention intervention.lvm intervention<- intervention<-.lvm
Plot/estimate surfaceksmooth2 surface
Define labels of graphedgelabels edgelabels<- edgelabels<-.lvm labels labels.graphNEL labels.lvm labels.lvmfit labels<- labels<-.default nodecolor nodecolor<- nodecolor<-.default
Set global options for 'lava'lava.options
Initialize new latent variable modellvm print.lvm summary.lvm
Create random missing datamakemissing
Two-stage (non-linear) measurement errormeasurement.error
Missing value generatorMissing Missing, Missing<-
Missing data examplemissingdata
Estimate mixture latent variable model.mixture
Extract modelModel Model<-
Model searchingmodelsearch
Estimate probabilities in contingency tablegkgamma kappa.multinomial kappa.table multinomial
Estimate mixture latent variable modelmvnmix
Convert to/from NANA2x x2NA
Example data (nonlinear model)nldata
Newton-Raphson methodNR
Example SEM data (nonlinear)nsem
Define variables as ordinalordinal ordinal<-
Univariate cumulative link regression modelsordreg
Generic method for finding indeces of model parametersparpos
Calculate partial correlationspartialcor
Extract pathways in model grapheffects effects.lvmfit path path.lvm totaleffects
Polychoric correlationpcor
Dose response calculation for binomial regression modelsPD
Convert pdf to raster formatpdfconvert
Plot method for 'estimate' objectsplot.estimate
Plot path diagramplot.lvm plot.lvmfit
Plot method for simulation 'sim' objectsdensity.sim plot.sim
Plot regression linesplotConf
Prediction in structural equation modelspredict.lvm predict.lvmfit
Predict function for latent variable modelspredictlvm
Generic print methodPrint
Define range constraints of parametersRange.lvm
Appending 'Surv' objectsrbind.Surv
Add regression association to latent variable modelregfix regfix.lvm regfix<- regfix<-.lvm regression regression.lvm regression<- regression<-.lvm
Create/extract 'reverse'-diagonal matrix or off-diagonal elementsoffdiag offdiag<- revdiag revdiag<-
Remove variables from (model) object.kill kill<- rmvar rmvar<-
Performs a rotation in the planerot2D rot3D rotate2
Calculate simultaneous confidence limits by Scheffe's methodscheffe
Example SEM datasemdata
Serotonin dataserotonin
Dataserotonin2
Simulate modelaalenExponential.lvm beta.lvm Binary.lvm binary.lvm binomial.lvm categorical categorical<- chisq.lvm constant.lvm coxExponential.lvm coxGompertz.lvm coxWeibull.lvm distribution distribution.lvm distribution<- distribution<-.lvm functional functional.lvm functional<- functional<-.lvm Gamma.lvm gamma.lvm gaussian.lvm GM2.lvm GM3.lvm heavytail heavytail<- id.lvm loggamma.lvm logit.lvm lognormal.lvm multinomial.lvm mvn.lvm none.lvm normal.lvm ones.lvm pareto.lvm poisson.lvm probit.lvm Sequence.lvm sim sim.lvm sim.lvmfit simulate.lvm simulate.lvmfit student.lvm threshold.lvm transform.lvm transform<- transform<-.lvm uniform.lvm weibull.lvm
Monte Carlo simulationas.sim sim.default
Spaghetti plotspaghetti
Stack estimating equationsstack.estimate
For internal useaddattr addhook checkmultigroup CoefMat CoefMat.multigroupfit decomp.specials deriv describecoef dmvn0 estimate.MAR expit finalize fixsome gaussian_logLik.lvm gethook getoutcome graph2lvm Identical igraph.lvm index index.lvm index.lvmfit index<- Inverse IV lisrel logit matrices merge missingModel modelPar modelVar multigroup na.pass0 offdiags parameter parfix parfix<- parlabels pars pars.glm pars.lvm pars.lvmfit procdata.lvmfit procformula profci randomslope randomslope<- reindex reorderdata rmvn0 rsq score.glm Specials starter.multigroup startvalues startvalues0 startvalues1 startvalues2 startvalues3 stdcoef subgraph tigol updatelvm variances Weights
Extract subset of latent variable modelmeasurement subset.lvm
Summary method for 'sim' objectssummary.sim
Time-dependent parameterstimedep timedep<-
Converts strings to formulatoformula
Trace operatortr
Trim string of (leading/trailing/all) white spacestrim
Twin menarche datatwindata
Two-stage estimatortwostage
Two-stage estimator (non-linear SEM)nonlinear nonlinear<- twostage.estimate twostage.lvm twostage.lvm.mixture twostage.lvmfit
Cross-validated two-stage estimatortwostageCV
Extract variable names from latent variable modelendogenous endogenous.lvm endogenous.lvmfit endogenous.multigroup exogenous exogenous.lvm exogenous.lvmfit exogenous.multigroup exogenous<- exogenous<-.lvm latent latent.lvm latent.lvmfit latent.multigroup latent<- latent<-.lvm manifest manifest.lvm manifest.lvmfit manifest.multigroup vars vars.lvm vars.lvmfit
vec operatorvec
Wait for user input (keyboard or mouse)wait waitclick
Weighted K-meanswkm
Wrap vectorwrapvec
Regression model for binomial data with unkown group of immortalszibreg