Skip to contents

Data management

Use these functions for the choice data preparation or simulation.

check_form()
Check model formula
overview_effects()
Print effect overview
create_lagged_cov()
Create lagged choice covariates
as_cov_names()
Re-label alternative specific covariates
prepare_data()
Prepare choice data for estimation
RprobitB_parameter()
Define probit model parameter
simulate_choices()
Simulate choice data
train_test()
Split choice data in train and test subset
plot(<RprobitB_data>)
Visualize choice data

Model fitting

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

check_prior()
Check prior parameters
fit_model()
Fit probit model to choice data
update(<RprobitB_fit>)
Update and re-fit probit model
transform(<RprobitB_fit>)
Transform fitted probit model

Model evaluation

Use these functions for model evaluation.

coef(<RprobitB_fit>)
Extract model effects
cov_mix()
Extract estimated covariance matrix of mixing distribution
point_estimates()
Compute point estimates
choice_probabilities()
Compute choice probabilities
classification()
Classify deciders preference-based
get_cov()
Extract covariates of choice occasion
predict(<RprobitB_fit>)
Predict choices
plot(<RprobitB_fit>)
Visualize fitted probit model
plot_roc()
Plot ROC curve

Model selection

Use these functions for model selection.

model_selection()
Compare fitted models
npar()
Extract number of model parameters
mml()
Approximate marginal model likelihood
compute_p_si()
Compute choice probabilities at posterior samples
pred_acc()
Compute prediction accuracy

Datasets

The following datasets are included in the package.

choice_berserk
Data of berserking choice

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 one-sided truncated normal
rttnorm()
Draw from two-sided truncated normal
rwishart()
Draw from Wishart distribution

Posterior samplers

These functions draw from conditional posterior distributions.

d_to_gamma()
Transform threshold increments to thresholds
ll_ordered()
Log-likelihood in the ordered probit model
update_Omega()
Update class covariances
update_Sigma()
Update error term covariance matrix of multiple linear regression
update_U()
Update latent utility vector
update_U_ranked()
Update latent utility vector in the ranked probit case
update_b()
Update class means
update_d()
Update utility threshold increments
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}.

M()
Matrix difference operator for ranked vectors
R_hat()
Compute Gelman-Rubin statistic
delta()
Matrix difference operator
euc_dist()
Euclidean distance
is_covariance_matrix()
Check covariance matrix properties
permutations()
Permutations of a vector
pprint()
Print abbreviated matrices and vectors