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

predict.lvm

Prediction in structural equation models


Description

Prediction in structural equation models

Usage

## S3 method for class 'lvm'
predict(
  object,
  x = NULL,
  y = NULL,
  residual = FALSE,
  p,
  data,
  path = FALSE,
  quick = is.null(x) & !(residual | path),
  ...
)

Arguments

object

Model object

x

optional list of (endogenous) variables to condition on

y

optional subset of variables to predict

residual

If true the residuals are predicted

p

Parameter vector

data

Data to use in prediction

path

Path prediction

quick

If TRUE the conditional mean and variance given covariates are returned (and all other calculations skipped)

...

Additional arguments to lower level function

See Also

predictlvm

Examples

m <- lvm(list(c(y1,y2,y3)~u,u~x)); latent(m) <- ~u
d <- sim(m,100)
e <- estimate(m,d)

## Conditional mean (and variance as attribute) given covariates
r <- predict(e)
## Best linear unbiased predictor (BLUP)
r <- predict(e,vars(e))
##  Conditional mean of y3 giving covariates and y1,y2
r <- predict(e,y3~y1+y2)
##  Conditional mean  gives covariates and y1
r <- predict(e,~y1)
##  Predicted residuals (conditional on all observed variables)
r <- predict(e,vars(e),residual=TRUE)

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.