This function performs MCMC simulation for fitting different types of probit models (binary, multivariate, mixed, latent class, ordered, ranked) to discrete choice data.
fit_model(
data,
scale = "Sigma_1,1 := 1",
R = 1000,
B = R/2,
Q = 1,
print_progress = getOption("RprobitB_progress", default = TRUE),
prior = NULL,
latent_classes = NULL,
fixed_parameter = list(),
save_beta_draws = FALSE
)An object of class RprobitB_fit.
An object of class RprobitB_data.
[character(1)]
A character which determines the utility scale. It is of the form
<parameter> := <value>, where <parameter> is either the name of a fixed
effect or Sigma_<j>,<j> for the <j>th diagonal element of Sigma, and
<value> is the value of the fixed parameter.
[integer(1)]
The number of iterations of the Gibbs sampler.
[integer(1)]
The length of the burn-in period.
[integer(1)]
The thinning factor for the Gibbs samples.
[logical(1)]
Print the Gibbs sampler progress?
[list]
A named list of parameters for the prior distributions. See the documentation
of check_prior for details about which parameters can be
specified.
[list() | NULL]
Optionally parameters specifying the number of latent classes and their
updating scheme. The values in brackets are the default.
C (1): The fixed number (greater or equal 1) of (initial) classes.
wb_update (FALSE): Set to TRUE for weight-based class updates.
dp_update (FALSE): Set to TRUE for Dirichlet process class updates.
Cmax (10): The maximum number of latent classes.
The following specifications are used for the weight-based updating scheme:
buffer (50): The number of iterations to wait before the next update.
epsmin (0.01): The threshold weight for removing a latent class.
epsmax (0.7): The threshold weight for splitting a latent class.
deltamin (0.1): The minimum mean distance before merging two classes.
deltashift (0.5): The scale for shifting the class means after a split.
[list]
A named list with fixed parameter values for alpha,
C, s, b, Omega, Sigma, Sigma_full,
beta, z, or d for the simulation.
See the vignette on model definition for definitions of these variables.
[logical(1)]
Save draws for decider-specific coefficient vectors? Usually not recommended,
as it requires a lot of storage space.
prepare_data() and simulate_choices() for building an
RprobitB_data object
update() for estimating nested models
transform() for transforming a fitted model
set.seed(1)
form <- choice ~ var | 0
data <- simulate_choices(form = form, N = 100, T = 10, J = 3, re = "var")
model <- fit_model(data = data, R = 1000)
summary(model)
Run the code above in your browser using DataLab