predict.biogeme_fit: Predict native probabilities or simulation expressions

View source: R/simulation.R

predict.biogeme_fitR Documentation

Predict native probabilities or simulation expressions

Description

Predict native probabilities or simulation expressions

Usage

## S3 method for class 'biogeme_fit'
predict(object, newdata = NULL, expressions = NULL, control = NULL, ...)

Arguments

object

A biogeme_fit or biogeme_bayesian_fit object.

newdata

Optional numeric data frame or biogeme_database used for a scenario prediction. When a data frame is supplied, the model database's derived-variable, filter, and panel metadata are retained.

expressions

Optional named list of complete symbolic expressions. For logit, nested-logit, and cross-nested-logit fits, omission produces one native probability column per alternative. For a generic model, the model's probability or simulation expressions are used.

control

Optional biogeme_control() object for native simulation.

...

Reserved for future prediction options; unsupported arguments are rejected explicitly.

Details

predict() is a convenience wrapper around simulate(). It does not calculate probabilities in R and does not refit the model. Use simulate() directly when several named quantities, posterior draws, or a custom simulation workflow are needed.

Value

A data frame containing values calculated by native Biogeme.

Examples

database <- biogeme_database(
  "demo",
  data.frame(choice = c(1, 2), x = c(1, 2))
)
model <- logit_model(
  database,
  choice = "choice",
  utilities = list(`1` = 0, `2` = biogeme_beta("b") * variable("x"))
)
# After fitting: predict(fit) or predict(fit, newdata = data.frame(...))

rbiogeme documentation built on Sept. 29, 2026, 5:09 p.m.