predict.RprobitB_fit {RprobitB} | R Documentation |
Predict choices
Description
This function predicts the discrete choice behavior
Usage
## S3 method for class 'RprobitB_fit'
predict(object, data = NULL, overview = TRUE, digits = 2, ...)
Arguments
object |
An object of class |
data |
Either
|
overview |
If |
digits |
The number of digits of the returned choice probabilities. |
... |
Ignored. |
Details
Predictions are made based on the maximum predicted probability for each choice alternative. See the vignette on choice prediction for a demonstration on how to visualize the model's sensitivity and specificity by means of a receiver operating characteristic (ROC) curve.
Value
Either a table if overview = TRUE
or a data frame otherwise.
Examples
data <- simulate_choices(
form = choice ~ cov, N = 10, T = 10, J = 2, seed = 1
)
data <- train_test(data, test_proportion = 0.5)
model <- fit_model(data$train)
predict(model)
predict(model, overview = FALSE)
predict(model, data = data$test)
predict(
model,
data = data.frame("cov_A" = c(1, 1, NA, NA), "cov_B" = c(1, NA, 1, NA)),
overview = FALSE
)