| predict.biogeme_fit | R Documentation |
Predict native probabilities or simulation expressions
## S3 method for class 'biogeme_fit'
predict(object, newdata = NULL, expressions = NULL, control = NULL, ...)
object |
A |
newdata |
Optional numeric data frame or |
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 |
... |
Reserved for future prediction options; unsupported arguments are rejected explicitly. |
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.
A data frame containing values calculated by native Biogeme.
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(...))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.