Learn R Programming

⚠️There's a newer version (0.2.0.4) of this package.Take me there.

cbq: An R Package for Conditional Binary Quantile Models

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.

Installation

# 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")
devtools::install_github("xiao-lu-research/cbq")

Usage


# Load the package
library(cbq)

# Get help
?cbq

# Simulate the data
x <- rnorm(50)
y <- ifelse(x > 0, 1, 0)
dat <- as.data.frame(cbind(y, x))

# Estimate the CBQ model
model <- cbq(y ~ x, dat, 0.5)

# Show the results
print(model)
coef(model)
plot(model)

References

Lu, X. (forthcoming) Discrete Choice Data with Unobserved Heterogeneity: A Conditional Binary Quantile Model. Political Analysis.

Copy Link

Version

Install

install.packages('cbq')

Monthly Downloads

281

Version

0.1.0.0

License

MIT + file LICENSE

Maintainer

Xiao Lu

Last Published

January 9th, 2020

Functions in cbq (0.1.0.0)

cbq-package

cbq: An R Package for Estimating Conditional Binary Quantile Models
plot_coef.cbq

Make coefficient plots for cbq
is.dichotomous

Check if a predictor is dichotomous, adopted from package circGLM
inverse

Inverse function
coef.cbq

Extract CBQ Coefficients
dald

Probability density function of asymmetric Laplace distributions
rald

Random number generator of asymmetric Laplace distributions
print_mcmc.cbq

Print the mcmc results from a cbq object
print_coef.cbq

Print cbq coefficients
print_text.cbq

Print the main results from a cbq object.
qald

Quantile function of asymmetric Laplace distributions
predict.cbq

Predictions based on the fitted parameter values
print.cbq

Print cbq object
cbq

Fitting conditional binary quantile models
plot.cbq

Plot cbq object
pald

Cumulative density function of asymmetric Laplace distributions
plot_trace.cbq

Make traceplots for cbq