quantregOR2: Bayesian quantile regression in the OR2 model

View source: R/ORII.R

quantregOR2R Documentation

Bayesian quantile regression in the OR2 model

Description

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

Usage

quantregOR2(y, x, b0, B0 , n0, d0, gammacp2, burn, mcmc, p, 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.

n0

prior shape parameter of the inverse-gamma distribution for \sigma, default is 5.

d0

prior scale parameter of the inverse-gamma distribution for \sigma, default is 8.

gammacp2

one and only cut-point other than 0, default is 3.

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).

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 OR2 model using a Gibbs sampling procedure. The function takes the prior distributions and other information as inputs and then iteratively samples \beta, \sigma, latent weight \nu, 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 bqrorOR2 object with components

  • summary: summary of the MCMC draws.

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

  • postMeansigma: posterior mean of \sigma from the complete Gibbs run.

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

  • postStdsigma: posterior standard deviation of \sigma from the complete Gibbs run.

  • dicQuant: all quantities of DIC.

  • logMargLike: an estimate of log marginal likelihood.

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

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

  • sigmadraws: dataframe of the \sigma draws from the complete Gibbs run, size is (1 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 sampling

Examples

set.seed(101)
data("data25j3")
y <- data25j3$y
xMat <- data25j3$x
k <- dim(xMat)[2]
b0 <- array(rep(0, k), dim = c(k, 1))
B0 <- 10*diag(k)
n0 <- 5
d0 <- 8
output <- quantregOR2(y = y, x = xMat, b0, B0, n0, d0, gammacp2 = 3,
burn = 10, mcmc = 40, p = 0.25, accutoff = 0.5, verbose = TRUE)

# Summary of MCMC draws :

#            Post Mean Post Std Upper Credible Lower Credible Inef Factor
#    beta_1   -4.5185   0.9837        -3.1726        -6.2000     1.5686
#    beta_2    6.1825   0.9166         7.6179         4.8619     1.5240
#    beta_3    5.2984   0.9653         6.9954         4.1619     1.4807
#    sigma     1.0879   0.2073         1.5670         0.8436     2.4228

# Log of Marginal Likelihood: -404.57
# DIC: 801.82


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

Related to quantregOR2 in bqror...