% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/predict.R, R/wrappers.R
\name{predict.imr}
\alias{predict.imr}
\alias{predict_imr}
\title{Predict Outcomes for New Subjects}
\usage{
\method{predict}{imr}(
  object,
  newdata,
  platform_names = NULL,
  covariates = NULL,
  max_models = 100,
  verbose = FALSE,
  ...
)

predict_imr(object, newdata, ...)
}
\arguments{
\item{object}{A fitted object of class `"imr"` returned by [imr()].}

\item{newdata}{A list of data frames with the new platform measurements.
Each data frame must include `id` as the first column, followed by finite
numeric feature columns matching the corresponding training platform.}

\item{platform_names}{A character vector giving, for each element of
`newdata`, the index (`"1"`, `"2"`, ...) of the corresponding training
platform.  Defaults to `NULL`, meaning the elements of `newdata` are taken
to be in the same order as the platforms supplied to [imr()].}

\item{covariates}{An optional data frame of clinical covariates for the test
subjects, including `id` as the first column.  Required when the model was
fitted with covariates and ignored with a warning when it was not.}

\item{max_models}{Integer; the maximum number of distinct selection models
(gamma configurations) used for Bayesian model averaging.  Default `100`.}

\item{verbose}{Logical; if `TRUE`, print the C routine's diagnostics.
Defaults to `FALSE`.}

\item{...}{Unused; present for S3 compatibility.}
}
\value{
A named list with one data frame per active availability subgroup
  model. Each data frame has columns `id` (subject identifier) and `predict`
  (predicted value or probability, rounded to three decimals).
}
\description{
`predict()` method for objects of class `"imr"` produced by [imr()].  New
subjects are matched to the availability subgroup models learned during
training, missing platforms are handled automatically, and the
test features are standardized with the training set's centring and scaling
factors before Bayesian model averaging.
}
\details{
Predictions are only produced for subjects observed on at least one platform
(and, when `covariates` is supplied, with covariate data).  For `"binary"`
outcomes the returned `predict` column is a probability obtained through the
probit link (`pnorm`); for `"continuous"` and `"right.censored"` outcomes it
is the predicted (latent) response.
}
\examples{
\donttest{
data("simIMR", package = "IntegMultiReg")
fit <- imr(
  platform_data_list = simIMR$platforms, outcome = simIMR$outcome,
  cov = simIMR$covariates, type_outcome = "binary",
  nu = c(-4, -3, -4), sample_mcmc = c(200, 100), ssize = 5, seed = 1
)
new_x <- simIMR$platforms[[1]][1:10, ]
new_z <- simIMR$platforms[[2]][1:7, ]
predict(fit, newdata = list(new_x, new_z), covariates = simIMR$covariates)
}
}
\seealso{
[imr()], [cv_imr()]
}
