quantregOR1: Bayesian quantile regression in the OR1 model

View source: R/ORI.R

quantregOR1R Documentation

Bayesian quantile regression in the OR1 model

Description

This function estimates Bayesian quantile regression in the OR1 model (ordinal quantile model with 3 or more outcomes) and reports the posterior mean, posterior standard deviation, 95 percent posterior credible intervals, and inefficiency factor of (\beta, \delta). The output also displays the log of marginal likelihood and the DIC.

Usage

quantregOR1(y, x, b0, B0, d0, D0, burn, mcmc, p, tune, accutoff, verbose)

Arguments

y

observed ordinal outcomes, column vector of size (n x 1).

x

covariate matrix of size (n x k) including a column of ones with or without column names.

b0

prior mean for \beta.

B0

prior covariance matrix for \beta.

d0

prior mean for \delta.

D0

prior covariance matrix for \delta.

burn

number of burn-in MCMC iterations.

mcmc

number of MCMC iterations, post burn-in.

p

quantile level or skewness parameter, p in (0,1).

tune

tuning parameter to adjust MH acceptance rate, default is 0.1.

accutoff

autocorrelation cut-off to identify the number of lags and form batches to compute the inefficiency factor, default is 0.05.

verbose

whether to print the final output and provide additional information or not, default is TRUE.

Details

This function estimates Bayesian quantile regression for the OR1 model using a combination of Gibbs sampling and Metropolis-Hastings algorithm. The function takes the prior distributions and other information as inputs and then iteratively samples \beta, latent weight w, \delta, and latent variable z from their respective conditional distributions.

The function also provides the logarithm of marginal likelihood and the DIC. These quantities can be utilized to compare two or more competing models at the same quantile. The model with a higher (lower) log marginal likelihood (DIC) provides a better model fit.

Value

Returns a bqrorOR1 object with components:

  • summary: summary of the MCMC draws.

  • postMeanbeta: posterior mean of \beta from the complete MCMC run.

  • postMeandelta: posterior mean of \delta from the complete MCMC run.

  • postStdbeta: posterior standard deviation of \beta from the complete MCMC run.

  • postStddelta: posterior standard deviation of \delta from the complete MCMC run.

  • gammacp: vector of cut points including (Inf, -Inf).

  • catprob: probability for each category, calculated at the posterior mean and the mean of x.

  • acceptancerate: acceptance rate of the proposed draws of \delta.

  • dicQuant: all quantities of DIC.

  • logMargLike: an estimate of the log marginal likelihood.

  • ineffactor: inefficiency factor for each component of \beta and \delta.

  • betadraws: dataframe of the \beta draws from the complete MCMC run, size is (k x nsim).

  • deltadraws: dataframe of the \delta draws from the complete MCMC run, size is ((J-2) x nsim).

References

Rahman, M. A. (2016). “Bayesian Quantile Regression for Ordinal Models.” Bayesian Analysis, 11(1): 1-24. DOI: 10.1214/15-BA939

See Also

rnorm, qnorm, Gibbs sampler, Metropolis-Hastings algorithm

Examples

 set.seed(101)
 data("data25j4")
 y <- data25j4$y
 xMat <- data25j4$x
 k <- dim(xMat)[2]
 J <- dim(as.array(unique(y)))[1]
 b0 <- array(rep(0, k), dim = c(k, 1))
 B0 <- 10*diag(k)
 d0 <- array(0, dim = c(J-2, 1))
 D0 <- 0.25*diag(J - 2)
 output <- quantregOR1(y = y, x = xMat, b0 ,B0, d0, D0,
 burn = 10, mcmc = 40, p = 0.25, tune = 1, accutoff = 0.5, verbose = TRUE)

 # Summary of MCMC draws:


 #             Post Mean  Post Std   Upper Credible Lower Credible Inef Factor
 # beta_1       -2.6202   0.3588        -2.0560        -3.3243       1.1008
 # beta_2        3.1670   0.5894         4.1713         2.1423       3.0024
 # beta_3        4.2800   0.9141         5.7142         2.8625       2.8534
 # delta_1       0.2188   0.4043         0.6541        -0.4384       3.6507
 # delta_2       0.4567   0.3055         0.7518        -0.2234       3.1784

 # MH acceptance rate: 36%
 # Log of Marginal Likelihood: -554.61
 # DIC: 1375.33


bqror documentation built on May 31, 2023, 5:19 p.m.

Related to quantregOR1 in bqror...