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

The interaction terms between genetic and environmental factors (G×E) are constructed internally within the function and therefore do not need to be provided by the user.

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, k, structure = "bilevel")
pred1 <- predict_mixedBayes(fit, y, X, e, g, k, slope = TRUE, loss = "L1")
print(pred1$pred_error)
fit <- mixedBayes(y, e, X, g, k, robust =FALSE, quant =NULL,structure = "bilevel")
pred2 <- predict_mixedBayes(fit, y, X, e, g, k, slope = TRUE, loss = "L2")
print(pred2$pred_error)


mixedBayes documentation built on Aug. 4, 2026, 5:08 p.m.