Skip to contents

This optional bridge method reconstructs predictions from the retained R formula, fixed-effect coefficient blocks, and training data. It covers a distributional parameter only when that payload and its canonical native link are available; it does not make a general engine-parity claim.

Usage

# S3 method for class 'drmTMB_julia'
predict(
  object,
  newdata = NULL,
  dpar = NULL,
  type = c("response", "link", "quantile"),
  prob = c(0.025, 0.5, 0.975),
  ...
)

# S3 method for class 'drmTMB_julia_xfam'
predict(object, newdata = NULL, dpar = NULL, type = c("response", "link"), ...)

Arguments

object

A drmTMB_julia fit.

newdata

Optional data frame. When supplied, predictions are population-level (random effects set to zero).

dpar

Distributional parameter to predict. Defaults to the first retained fixed-effect dpar. For type = "quantile" on a bivariate biv_gaussian fit, dpar instead selects which response's marginal quantile to compute.

type

"response" (default), "link", or "quantile".

prob

Numeric vector of probabilities in (0, 1), used only when type = "quantile".

...

Reserved.

Value

A numeric vector of predictions, length nrow(newdata) when newdata is supplied. For type = "quantile", a numeric matrix with one row per observation and one column per prob, with attr(., "calibrated") == FALSE.

Details

With newdata = NULL, predict() reconstructs a fixed-effect stored-data prediction, except for a validated Gaussian ordinary mean payload. The earned conditional routes are one scalar intercept or slope, one correlated intercept-and-slope component, or scalar components with distinct grouping variables. It refuses repeated groups, multiple correlated components, wider slopes, scale random effects, and structured routes. With newdata supplied, it returns a population-level fixed-effect prediction (RE = 0) from X %*% beta, using the training data to preserve factor contrasts and column order. type = "link" returns the linear predictor and type = "response" applies the canonical native dpar link.

Fresh-data support includes only retained fixed-effect distributional parameters with a recognized native link. Random-effect scale components and other non-dpar coefficient blocks are refused.

type = "quantile" returns per-row conditional quantiles of the fitted RESPONSE distribution, computed by the SAME native code the engine = "tmb" method uses (predict.drmTMB() -> fitted_distribution()'s q()), driven by this fit's own reconstructed distributional parameters. It therefore inherits that method's contract exactly: a matrix with one row per observation and one column per prob, columns named as percentages, attr(., "calibrated") == FALSE (a distributional plug-in interval at the point estimate, not a calibrated-coverage interval), and the "spike"/"unimplemented" family status gate. Because the parameters come from this method's own reconstruction, the quantiles are FIXED-EFFECT, population-level for newdata rows and carry the same conditional random-effect scope as type = "response" for stored rows. For a bivariate biv_gaussian fit, dpar selects which response's MARGINAL quantile to return ("mu1"/"sigma1" or "mu2"/"sigma2"); rho12 is ignored. A binomial or beta_binomial newdata quantile needs a trials column, as it does natively.

type = "quantile" is REFUSED on a meta_V() fit through this engine: a Julia-bridge fit does not retain the per-row known sampling variance, so its gaussian quantiles would silently use sigma alone instead of the total observation SD sqrt(V + sigma^2). Use engine = "tmb" for meta-analysis quantiles; type = "response" and type = "link" are unaffected.

A legacy cross-family object (drmTMB_julia_xfam) is narrower still: only mu1 and mu2 are available. Stored and new-data predictions are response means with the shared latent effect fixed at u = 0; they are not marginal means. Cross-family covariance, fixed-effect Wald inference, and scale-axis prediction are unavailable because that legacy bridge did not retain the required payload. It has no type = "quantile".