% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/predict_maihda.R
\name{predict_maihda}
\alias{predict_maihda}
\title{Predict from MAIHDA Model}
\usage{
predict_maihda(
  object,
  newdata = NULL,
  type = c("individual", "strata", "response", "link"),
  scale = c("response", "link"),
  ...
)
}
\arguments{
\item{object}{A maihda_model object from \code{fit_maihda()}.}

\item{newdata}{Optional data frame for making predictions. If NULL, uses the
original data from model fitting.}

\item{type}{Character string specifying prediction type:
\itemize{
  \item "individual": Individual-level predictions including random effects
  \item "strata": Stratum-level predictions (random effects only)
}
For backward compatibility, "link" or "response" may also be passed here
and will be interpreted as individual-level predictions on that scale.}

\item{scale}{Character string specifying the prediction scale for
individual-level predictions: "response" (default) or "link".}

\item{...}{Additional arguments passed to predict method of underlying model.}
}
\value{
Depending on type:
  \itemize{
    \item For "individual": A numeric vector of predicted values on the
      requested scale
    \item For "strata": A data frame with stratum ID and predicted random effect
  }
}
\description{
Makes predictions from a fitted MAIHDA model, either at the stratum level
or individual level.
}
\examples{
\donttest{
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")
}

}
