drawbetaOR2 {bqror} | R Documentation |
Samples \beta
in the OR2 model
Description
This function samples \beta
from its conditional
posterior distribution in the OR2 model (ordinal quantile model with exactly 3
outcomes).
Usage
drawbetaOR2(z, x, sigma, nu, tau2, theta, invB0, invB0b0)
Arguments
z |
continuous latent values, vector of size |
x |
covariate matrix of size |
sigma |
|
nu |
modified latent weight, column vector of size |
tau2 |
2/(p(1-p)). |
theta |
(1-2p)/(p(1-p)). |
invB0 |
inverse of prior covariance matrix of normal distribution. |
invB0b0 |
prior mean pre-multiplied by invB0. |
Details
This function samples \beta
, a vector, from its conditional posterior distribution
which is an updated multivariate normal distribution.
Value
Returns a list with components
beta: |
|
Btilde: |
variance parameter for the posterior multivariate normal distribution. |
btilde: |
mean parameter for the posterior multivariate normal distribution. |
References
Rahman, M. A. (2016). '"Bayesian Quantile Regression for Ordinal Models."' Bayesian Analysis, 11(1): 1-24. DOI: 10.1214/15-BA939
See Also
Gibbs sampling, normal distribution , rgig, inv
Examples
set.seed(101)
z <- c(21.01744, 33.54702, 33.09195, -3.677646,
21.06553, 1.490476, 0.9618205, -6.743081, 21.02186, 0.6950479)
x <- matrix(c(
1, -0.3010490, 0.8012506,
1, 1.2764036, 0.4658184,
1, 0.6595495, 1.7563655,
1, -1.5024607, -0.8251381,
1, -0.9733585, 0.2980610,
1, -0.2869895, -1.0130274,
1, 0.3101613, -1.6260663,
1, -0.7736152, -1.4987616,
1, 0.9961420, 1.2965952,
1, -1.1372480, 1.7537353),
nrow = 10, ncol = 3, byrow = TRUE)
sigma <- 1.809417
n <- dim(x)[1]
nu <- array(5 * rep(1,n), dim = c(n, 1))
tau2 <- 10.6667
theta <- 2.6667
invB0 <- matrix(c(
1, 0, 0,
0, 1, 0,
0, 0, 1),
nrow = 3, ncol = 3, byrow = TRUE)
invB0b0 <- c(0, 0, 0)
output <- drawbetaOR2(z, x, sigma, nu, tau2, theta, invB0, invB0b0)
# output$beta
# -0.74441 1.364846 0.7159231