Skip to contents

Generate predictions from fitted AME models, including point estimates and predictive distributions.

Usage

# S3 method for class 'ame'
predict(
  object,
  newdata = NULL,
  type = c("response", "link", "distribution"),
  n_samples = 100,
  include_uncertainty = TRUE,
  ...
)

Arguments

object

Fitted AME model object

newdata

Optional dyadic covariates for prediction: a single 3-D array (n x n x p_dyad) whose slices match the dyadic covariates the model was fit with (same order; do not include the intercept or nodal-covariate slices). Nodal covariates cannot be changed at prediction time – their fitted contribution is reused. When omitted, the fitted design is used.

type

Character; type of prediction:

  • "response": predicted values on response scale (default)

  • "link": predicted values on link scale

  • "distribution": full posterior predictive distribution

n_samples

For type="distribution", number of posterior samples

include_uncertainty

Logical; include parameter uncertainty (default TRUE)

...

Additional arguments (not used)

Value

Depending on type:

  • "response"/"link": Matrix of predictions

  • "distribution": Array of posterior predictive samples

Author

Cassy Dorff, Shahryar Minhas, Tosin Salau

Examples

# \donttest{
# Fit model
data(YX_nrm)
fit <- ame(YX_nrm$Y, Xdyad = YX_nrm$X, R = 2,
           nscan = 100, burn = 10, odens = 1, verbose = FALSE)

# Point predictions
Y_pred <- predict(fit)

# Predictions on link scale
Y_link <- predict(fit, type = "link")
# }