predict.lmmelsm: Predict method for lmmelsm objects.

View source: R/predict.R

predict.lmmelsmR Documentation

Predict method for lmmelsm objects.

Description

Generates posterior predictions from fitted LMMELSM object.

Usage

## S3 method for class 'lmmelsm'
predict(
  object,
  newdata = NULL,
  prob = 0.95,
  summarize = TRUE,
  include_error = TRUE,
  ...
)

Arguments

object

lmmelsm object.

newdata

Data.frame (Default: NULL). If NULL, uses original data.frame.

prob

Numeric (Default: .95). Amount of probability mass contained in the credible interval.

summarize

Logical (Default: TRUE). Whether to return posterior summaries (TRUE) or MCMC samples (FALSE).

include_error

Logical (Default: TRUE). If TRUE, then include stochastic realizations in outcome variables.

...

Not used.

Details

If the grouping variable is missing, or contains NAs, then new random effects are generated from the posterior random effect distribution. Where the grouping variables are not missing, the posterior standardized, orthogonalized random effects are obtained from the fitted model, and used as a basis for predicted random effects. Because the standardized, orthogonalized random effects are used, one can include different between-group variance values to predict new RE variances, and therefore a different random effect value. That is, the random effect, conditional on new between-group variance model covariates, is equal to:

u_i = z_i U D_i

, where D_i is the predicted between-group random effect SD, U is the upper cholesky factorization of the random effect correlations, and z_i is the standardized, orthogonalized random effect for group i.

Value

List. If summarize is TRUE, then a list of outcome (eta, eta_logsd) and indicator (y) posterior predictive distribution summaries. If FALSE, an N-length list of lists of outcome and indicator MCMC samples.

Author(s)

Stephen Martin


LMMELSM documentation built on Dec. 28, 2022, 1:32 a.m.