Learn R Programming

mixedBayes (version 0.2.1)

predict_mixedBayes: Make predictions from a mixedBayes object

Description

Make predictions from a mixedBayes object

Usage

predict_mixedBayes(object, y, X, e, g, w, k, slope, loss)

Value

an object of class `mixedBayes.pred' is returned, which is a list with components:

pred_error

prediction error.

y_hat

predicted values of the repeated measured responses.

Arguments

object

a mixedBayes object.

y

a numeric vector of repeated-measure responses in long format. The current version only supports continuous response.

X

the long-format design matrix, including an intercept and optionally time-related covariates.

e

the long-format design matrix for environment/treatment effects. In applications, this is a set of dummy variables encoding treatment levels.

g

the long-format matrix of genetic predictors.

w

the long-format matrix of gene-environment interaction terms.

k

integer. Number of repeated measurements per subject.

slope

logical flag. If TRUE, random intercept-and-slope model will be used.

loss

character string specifying the prediction loss function. "L1" for mean absolute error; "L2" for mean squared error.

See Also

mixedBayes

Examples

Run this code
data(data)

fit <- mixedBayes(y, e, X, g, w, k, structure = c("bi-level"))
pred1 <- predict_mixedBayes(fit, y, X, e, g, w, k, slope = TRUE, loss = "L1")
print(pred1$pred_error)
pred2 <- predict_mixedBayes(fit, y, X, e, g, w, k, slope = TRUE, loss = "L2")
print(pred2$pred_error)

Run the code above in your browser using DataLab