View source: R/predict_maihda.R
| predict_maihda | R Documentation |
Makes predictions from a fitted MAIHDA model, either at the stratum level or individual level.
predict_maihda(object, newdata = NULL, type = c("individual", "strata"), ...)
object |
A maihda_model object from |
newdata |
Optional data frame for making predictions. If NULL, uses the original data from model fitting. |
type |
Character string specifying prediction type:
|
... |
Additional arguments passed to predict method of underlying model. |
Depending on type:
For "individual": A numeric vector of predicted values
For "strata": A data frame with stratum ID and predicted random effect
strata_result <- make_strata(maihda_sim_data, vars = c("gender", "race"))
model <- fit_maihda(health_outcome ~ age + (1 | stratum), data = strata_result$data)
# Individual predictions
pred_ind <- predict_maihda(model, type = "individual")
# Stratum predictions
pred_strata <- predict_maihda(model, type = "strata")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.