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) ). 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.


  • Version 1.4.6 <2016-12-14 Wed>

    • New backtrace algorithms for Newton-Raphson optimization routine.
    • 'diagtest' updated.
  • Version 1.4.5 <2016-10-25 Tue>

    • New graph functions: dsep: check for d-separation (conditional independence). backdoor: check backdoor criterion of a graph (lvm-object). adjMat: return adjaceny matrix. edgeList: return edge list. ancestors: return ancenstors of nodes. descendants: return descendants of nodes.
    • All simple paths in a graph can now be extracted with: path(...,all=TRUE)
    • Covariance parameters are now reference with ~~ instead of ,. Applies to setting starting values in 'estimate', parameters in 'sim','compare','estimate',...
      To use the old syntax set 'lava.options(symbol=c("~",","))'
    • 'layout' argument added to lava.options (default 'dot')
    • visNetwork support, new 'plot.engine' argument added to plot methods.
    • bootstrap.lvmfit now default returns original estimates.
    • print, transform methods updated (transform output).
    • '+' operator overloaded for lvm and estimate objects (merge).
    • New composite likelihood function: complik.
    • New functions for simple association measures: riskcomp, rdiff, rratio,...
    • New argument 'latent' in simulate method. If FALSE the latent variables are dropped from the returned data.frame.
    • modelsearch by default now shows both directional or undirectional associations (type='all' vs type='cor').
    • sim.default now stores timings. New print functions (data.table like output).
    • lvm model can now be updated with the 'sim' function, for instance setting parameter values for the simulation only once: m <- sim(m,p=p,...), with faster subsequent calls sim(m,n=n).
    • estimate.default can now simulate p-values ('R' argument). Returns an object which can also be used as input for 'estimate'.
    • Bug fixes: NR optimization with back-tracing; fixed matrices.lvm when called without variance parameters; fixed a bug in r-square computations.
    • Contrast matrix can be specified with the function 'contr'.
  • Version 1.4.4 <2016-08-13 Sat>

    • estimate.default will now use the id-variable of an 'estimate' object if the 'id' argument is left unspecified. For multinomial,gkgamma,kappa additional arguments (...) are now parsed on the 'estimate.default' (including id).
    • Updated print/summary methods for 'estimate.default'. Sample/cluster-size added to output.
    • Code clean-up and optimization. Smarter calculations of kronecker products, and some regular expressions updated.
    • New function 'predictlvm' which return jacobian.
    • Intercepts can now be specified via parantheses, e.g., y ~ (-2) + x
    • 'getoutcome' with sep argument for splitting '|' statements in formulas.
    • Partial gamma, gkgamma, updated (probability interpretation, homogeneity tests removed)
    • 'moments' function now returns conditional mean with multiple rows. Side effect fixed across multiple functions
    • twostage function with support for mixture models
    • Beta (Beta.lvm) and Finite Gaussian (GM2.lvm,GM3.lvm) Mixtures added.
    • 'sim': parameters can now be specified as part of '...'
    • summary.sim: calculate Wald CI if confint=TRUE, otherwise use the user supplied confidence limits.
    • Clopper-pearson intervals and exact binomial tests added to 'diagtest'.
    • Interval censoring with 'normal' estimator, which now also works with 'binary' definitions.
    • default plot style updated.
  • Version 1.4.3 <2016-04-11 Mon>

    • partial gamma coefficients (gkgamma)
    • Unit tests works with new testthat version
    • Avoid trying to fork new processes on windows (bootstrap,sim.default)
  • Version 1.4.2 <2016-04-05 Wed>

    • Code optimization and minor bug fixes
    • Travis-CI, unit-tests
    • glm estimator update (censored regression)
    • polychoric correlations (pcor)
    • New utility functions: wrapvec, offdiag
    • simulation: regression design on parameters (see weibull + variance hetereogeneity example in help('sim'))
    • Byte compile by default
  • Version 1.4.1 <2015-06-13 Sat>

    • New plot.estimate method
    • Documentation and examples updated
  • Version 1.4.0 <2015-02-15 Sun>

    • Linear measurement error model: 'measurement.error'
    • Diagnostic tests: 'diagtest'
    • 'plotConf' updated with support for special function terms (I, poly, ns, ...). Old version is available (not in namespace) as lava:::plotConf0
    • Pareto distribution: 'pareto.lvm'
    • Code clean-up/optimization: 'EventTime', 'stack'
    • 'estimate.default' new syntax for contrast specification (parsedesign)
    • 'regression.lvm' with y,x argument (as alias for to,from)
    • plot longitudinal data: 'spaghetti'
    • Examples updated
  • Version 1.3.0 <2014-11-18 Tue>

    • New syntax for categorical predictors (method 'categorical' and argument 'additive=FALSE' with 'regression method)
    • Argument 'intervals' added to 'ones.lvm' for piece-wise constant effects
    • Argument 'average=TRUE' now needed for empirical averages in estimate.default
    • Fixed a bug in score.glm (with weights and offset) introduced in version 1.2.6
    • estimate.default:
      • small-sample corrections
      • Default id from row names in estimate.default (used with merge method)
      • iid decompostion also returned for hypothesis contrasts
      • keep argument added to estimate.default and merge
      • labels argument added to estimate.default
    • 'images' function for visualization of tabular data added to namespace
    • 'ksmooth' and 'surface' for surface estimation and visualization of bivariate data and functions
    • 'dsort': Sort data.frames
    • general multivariate distributions in simulations. see example in 'sim'
    • 'or2prob', 'tetrachoric' for conversion from OR to probabilities (and tetrachoric correlations). 'prob.normal': calculates probabilities from threshold model given thresholds and variance See also mets:::assoc for calculations of kappa, gamma, uncer.coef. 'normal.threshold': returns thresholds,variance,mu from model with categorical outcomes.
    • Multiple testing routines: closed.testing, p.correct, ...
    • 'Missing' method updated with a simple 'suffix' argument
    • Back-tracing updated in Newton-Raphson routine
  • Version 1.2.6 <2014-05-07 Wed>

    • New 'stack' function for two-stage estimation (via 'estimate' objects)
    • New 'blocksample' function for resampling clustered data.
    • New function 'Missing' to generate complex missing data patterns
    • Weibull parametrization of 'coxWeibull.lvm' rolled back (ver. 1.2.4). The function 'weibull.lvm' now leads to Accelerated Failure Time model (see examples of 'eventTime')
    • iid function cleanup (new 'bread' attribute). iid.glm now gives correct estimated influence functions for 'quasi' link (constant variance)
    • Parameter constraints on (co)variance parameters now possible with the syntax lvm(...,y~~a*x) (corresponding to covariance(...,y~x)<-"a")
    • Some additional utilities: pdfconvert, scheffe, images, click. confband updated with 'polygon' argument.
    • New function getMplus: Import results from Mplus
    • New function getSAS: Import SAS ODS
    • New 'edgecolor' argument of plot-function
  • Version 1.2.5 <2014-03-13 Thu>

    • 'merge' method added for combining 'estimate' objects
    • Adjustments to starting values
    • Function 'categorical' for adding categorical predictors to simulation model
    • Improved flexibility in simulations with 'transform','constrain' (ex: categorical predictors)
    • Added 'dataid' argument to estimate.default allowing different id for 'data' and i.i.d. decomposition of model parameter estimates. With the argument 'stack=FALSE' influence functions within clusters will not be stacked together.
    • R-squared values (+ approximate standard errors/i.i.d. decomposition) via 'rsq(model,TRUE)'
    • New infrastructure for adding additional parameters to models (no user-visible changes).
    • multinomial function for calculating influence curves for multinomial probabilities. 'gammagk' and 'kappa' methods for calculating Goodman-Kruskals gamma and Cohens kappa coefficients.
    • ordreg function for univariate ordinal regression models
    • iid methods for data.frames/matrices (empirical mean and variance)
    • Support for using 'mets::cluster.index' in GEE-type models (much faster).
    • plotConf updated (vcov argument added and more graphical arguments parsed to plotting functions)
    • Additional unit-tests implemented
    • New 'forestplot' and 'Combine' functions
    • Covariance structure may now be specified using '~~', e.g. 'lvm(c(y,v)~~z+u)' specifies correlation between residuals of (y,z),(y,u),(v,z),(v,u).
  • Version 1.2.4 <2013-12-01 Sun>

    • Avoid estimating IC in 'estimate.default' when 'vcov' argument is given.
    • New default starting values
    • Time-varying effects via 'timedep'
    • R-squared added to summary
    • alias: covariance->variance
    • added size argument to binomial.lvm;
  • Version 1.2.3 <2013-10-27 Sun>

    • 'subset' argument added to estimate.default. Calculates empirical averages conditional on subsets of data
    • Improved output from compare/estimate functions
    • Minor bug fixes (plot, predict)
    • sim: Piecewise constant rates with coxEponential.lvm. New aalenExponential.lvm function for additive models. Functions ones.lvm and sequence.lvm for deterministic variables.
  • Version 1.2.2 <2013-07-10 Wed>

    • Regression parameters are now by default referenced using '~', e.g. "y~x" instead of "y<-x". Applies to setting starting values in 'estimate', parameters in 'sim','compare','estimate',.... To use the old syntax set 'lava.options(symbol=c("<-","<->"))'
    • Newton-Raphson/scoring procedure updated
    • Search-interval for profile likelihood CI improved (for variance parameters)
    • 'estimate.default' updated (LRT)
    • 'iid' updated (variance now obtained as tensor product of the result)
    • progress bar for 'bootstrap' and 'modelsearch'
    • various minor bug fixes
    • new functions: Expand (expand.grid wrapper), By (by wrapper)
  • Version 1.2.1 <2013-05-10 Fri>

    • Optimization + minor bug fixes
  • Version 1.2.0 <2013-03-28 Thu>

    • New method 'iid' for extracting i.i.d. decomposition (influence functions) from model objects (e.g. glm, lvm, ...)
    • Method 'estimate' can now be used on model objects to transform parameters (Delta method) or conduct Wald tests. Average effects, i.e. averaging functionals over the empirical distribution is also possible including calculation of standard errors.
    • 'curereg' function for estimating mixtures of binary data.
    • Instrumental Variable (IV) estimator (two-stage least-squares) optimized.
    • New distributions: Gamma.lvm, coxWeibull.lvm, coxExponential.lvm, coxGompertz.lvm. New method 'eventTime' (for simulation of competing risks data)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.6 by Klaus K. Holst, 7 days ago

Report a bug at

Browse source code at

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

Documentation:   PDF Manual  

Task views: Psychometric Models and Methods

GPL-3 license

Imports grDevices, graphics, methods, numDeriv, stats, survival, SQUAREM, utils

Suggests KernSmooth, Matrix, Rgraphviz, ascii, data.table, ellipse, fields, foreach, geepack, gof, graph, igraph, lava.tobit, lme4, mets, optimx, quantreg, rgl, testthat, visNetwork, zoo

Imported by BuyseTest, Publish, SmoothHazard, prodlim, riskRegression, timereg.

Depended on by lava.tobit, mets.

Suggested by gof, pec, soil.spec.

See at CRAN