View source: R/predict_mixedBayes.R
| predict_mixedBayes | R Documentation |
Make predictions from a mixedBayes object
predict_mixedBayes(object, y, X, e, g, w, k, slope, loss)
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. |
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. |
mixedBayes
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.