Skip to contents

Data management

Use these functions for the choice data preparation or simulation.

check_form()
Check the model formula
overview_effects()
Effect overview
create_lagged_cov()
Create lagged choice covariates
as_cov_names()
Relabel the alternative specific covariates to the required format
missing_data()
Handle missing choice data
prepare_data()
Prepare empirical choice data for estimation
RprobitB_parameter()
Create object of class RprobitB_parameter
simulate_choices()
Simulate choice data
train_test()
Split choice data set in two parts
plot(<RprobitB_data>)
Plot method for RprobitB_data

Model fitting

Use these function for fitting a probit model to choice data.

check_prior()
Check prior parameters
mcmc()
Probit model fitting via Markov chain Monte Carlo simulation
nested_model()
Estimating a nested model
transform(<RprobitB_fit>)
Transform an RprobitB_fit object

Model evaluation

Use these functions for model evaluation.

coef(<RprobitB_fit>)
Linear coefficients
cov_mix()
Estimated covariance matrix of the mixing distribution
point_estimates()
Compute point estimates based on Gibbs samples of an RprobitB_fit object
choice_probabilities()
Return choice probabilities of an RprobitB_fit.
preference_classification()
Classify deciders based on their preferences
get_cov()
Get covariates of choice situation
predict(<RprobitB_fit>)
Choice prediction
plot(<RprobitB_fit>)
Plot method for RprobitB_fit

Model selection

Use these functions for model selection.

model_selection()
Compare fitted models
AIC()
Akaike's Information Criterion
BIC()
Bayesian Information Criterion
logLik()
Log-likelihood value
nobs()
Number of observations
npar()
Number of model parameters
mml()
Marginal model likelihood
compute_p_si()
Compute probability for each observed choice at posterior samples
pred_acc()
Prediction accuracy

Datasets

The following datasets are included in the package.

choice_berserk
Choice of berserking
choice_chess_opening
Choice of a chess opening

Fitted model

The package contains the following fitted models.

model_elec
Mixed probit model for multivariate choice between electricity suppliers
model_train
Probit model for binary choice between Train trip alternatives
model_train_sparse
Probit model for binary choice between Train trip alternatives with the price as the only explanatory variable

Distributions

Implementation of distributions and number generating functions.

dmvnorm()
Density of multivariate normal distribution
rdirichlet()
Draw from Dirichlet distribution
rmvnorm()
Draw from multivariate normal distribution
rtnorm()
Draw from truncated normal
rwishart()
Draw from Wishart distribution

Posterior samplers

These functions draw from the conditional posterior distributions of the model parameters.

update_Omega()
Update class covariances
update_Sigma()
Update error term covariance matrix of multiple linear regression
update_U()
Update latent utility vector
update_b()
Update class means
update_m()
Update class sizes
update_reg()
Update coefficient vector of multiple linear regression
update_s()
Update class weight vector
update_z()
Update class allocation vector

Utilities

These functions may be useful beyond {RprobitB}.

R_hat()
Compute Gelman-Rubin statistic
delta()
Matrix difference operator
euc_dist()
Euclidean distance
is_covariance_matrix()
Check covariance matrix properties
pprint()
Print abbreviated matrices and vectors