predict_mixedBayes: Make predictions from a mixedBayes object

View source: R/predict_mixedBayes.R

predict_mixedBayesR Documentation

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)

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 group 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.

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.

See Also

mixedBayes

Examples

data(data)

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


mixedBayes documentation built on March 17, 2026, 1:07 a.m.