# Introduction

`{RprobitB}` implements Bayes estimation of probit choice models in cross-sectional and panel settings. The package can analyze binary, multivariate, ordered, and ranked choices, as well as heterogeneity of choice behavior among deciders. The main functionality includes model fitting via Gibbs sampling, tools for convergence diagnostic, choice data simulation, in-sample and out-of-sample choice prediction, and model selection using information criteria and Bayes factors. The latent class model extension facilitates preference-based decider classification, where the number of latent classes can be inferred via the Dirichlet process or a weight-based updating heuristic. This allows for flexible modeling of choice behavior without the need to impose structural constraints. See the vignette on the model definition for details about the probit model.

Working with `{RprobitB}` follows a structured workflow. The main functions fall into three categories: data management, model fitting, and model evaluation, as illustrated in the flowchart below. A typical workflow proceeds as follows:

1. Prepare a choice data set via the `prepare_data()` function or simulate data via `simulate_choices()`. Both functions return an `RprobitB_data` object that can be fed into the estimation routine. The `train_test()` allows to split the data into an estimation and a validation part. See the vignette on choice data for details.

2. The estimation routine is called `fit_model()` and returns an `RprobitB_fit` object. The `transform_fit()` function allows to change normalization of the model after a model has been fitted. The details are documented in the vignettes on model fitting and on modeling heterogeneity.

3. The `RprobitB_fit` object can be fed into `coef()` to show the covariate effects on the choices and into `predict()` to compute choice probabilities and forecast choice behavior if choice characteristics would change, see the vignette on choice prediction. The `classification()` function allows for preference-based decider classification. The function `model_selection()` compares `RprobitB_fit` objects by computing different model selection criteria, see the vignette on model selection.

The flowchart of `{RprobitB}`.