Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

predictlvm

Predict function for latent variable models


Description

Predictions of conditinoal mean and variance and calculation of jacobian with respect to parameter vector.

Usage

predictlvm(object, formula, p = coef(object), data = model.frame(object), ...)

Arguments

object

Model object

formula

Formula specifying which variables to predict and which to condition on

p

Parameter vector

data

Data.frame

...

Additional arguments to lower level functions

See Also

predict.lvm

Examples

m <- lvm(c(x1,x2,x3)~u1,u1~z,
         c(y1,y2,y3)~u2,u2~u1+z)
latent(m) <- ~u1+u2
d <- simulate(m,10,"u2,u2"=2,"u1,u1"=0.5,seed=123)
e <- estimate(m,d)

## Conditional mean given covariates
predictlvm(e,c(x1,x2)~1)$mean
## Conditional variance of u1,y1 given x1,x2
predictlvm(e,c(u1,y1)~x1+x2)$var

lava

Latent Variable Models

v1.6.10
GPL-3
Authors
Klaus K. Holst [aut, cre], Brice Ozenne [ctb], Thomas Gerds [ctb]
Initial release
2021-09-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.