The package cbq
provides basic functionalities of
conditional binary quantile models using Markov chain Monte Carlo
methods. The estimation is conducted through pre-compiled stan codes.
The conditional binary quantile (CBQ) models extend the simple version
of binary quantile models for analyzing discrete choices (including but
beyond binary choices) with varying choice alternatives. Each quantile
estimation represents a local inspection of effects at the specified
quantile of the choice probabilities. In the simple binary setting, the
features of the choice alternatives within each choice set are assumed
to be the same. However, in reality we oftentimes observe individuals
who are facing different sets and numbers of choice alterantives. The
CBQ models are developed to solve this problem by introducing a
conditional multinomial structure for modeling varying choice
alternatives. Even though the CBQ models are called “binary”, they
actually belong to a more general family of dicrete choice models. I
refer the readers to Lu
(2020) for the details of the estimation.
# Make sure that the following packages have been installed in your local R environment
if(!require(rstan)) install.packages("rstan")
# Install cirque from github
if(!require(devtools)) install.packages("devtools")
::install_github("xiao-lu-research/cbq") devtools
# Load the package
library(cbq)
# Get help
?cbq
# Simulate the data
<- rnorm(50)
x <- ifelse(x > 0, 1, 0)
y <- as.data.frame(cbind(y, x))
dat
# Estimate the CBQ model
<- cbq(y ~ x, dat, 0.5)
model
# Show the results
print(model)
coef(model)
plot(model)
Lu, Xiao. (2020). Discrete Choice Data with Unobserved Heterogeneity: A Conditional Binary Quantile Model. Political Analysis, 28(2), 147-167.