Learn R Programming

tramME (version 0.0.1)

predict.tramME: Predict method for tramME objects

Description

Evaluates the _conditional_ distribution implied by a tramME model, given by a set of covariates and random effects on a desired scale. When newdata contains values of the response variable, prediction is only done for those values. When no response values are supplied, prediction is done on a grid of values. Unfitted tramME models can also be used for prediction as long as the coefficent parameter are set manually (with coef<-).

Usage

# S3 method for tramME
predict(object, newdata = NULL, ranef = NULL, ...)

Arguments

object

A tramME object

newdata

an optional data frame of observations

ranef

Vector of random effects or the word "zero". See details.

...

Additional arguments, passed to predict.mlt.

Value

A numeric matrix of the predicted values invisibly

Details

When ranef is equal to "zero", a vector of zeros with the right size is substituted.

Examples

Run this code
# NOT RUN {
data("sleepstudy", package = "lme4")
fit <- BoxCoxME(Reaction ~ Days + (Days | Subject), data = sleepstudy)
predict(fit, type = "trafo") ## evaluate on the transformation function scale
nd <- sleepstudy
nd$Reaction <- NULL
pr <- predict(fit, newdata = nd, ranef = ranef(fit, raw = TRUE), type = "distribution",
              K = 100)
# }

Run the code above in your browser using DataLab