drawbetaOR1 {bqror}R Documentation

Samples \beta in the OR1 model

Description

This function samples \beta from its conditional posterior distribution in the OR1 model (ordinal quantile model with 3 or more outcomes).

Usage

drawbetaOR1(z, x, w, tau2, theta, invB0, invB0b0)

Arguments

z

continuous latent values, vector of size (n x 1).

x

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

w

latent weights, column vector of size size (n x 1).

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:

\beta, a column vector of size (k x 1), sampled from its condtional posterior distribution.

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, mvrnorm, inv

Examples

set.seed(101)
data("data25j4")
xMat <- data25j4$x
p <- 0.25
n <- dim(xMat)[1]
k <- dim(xMat)[2]
w <- array( (abs(rnorm(n, mean = 2, sd = 1))), dim = c (n, 1))
theta <- 2.666667
tau2 <- 10.66667
z <- array( (rnorm(n, mean = 0, sd = 1)), dim = c(n, 1))
b0 <- array(0, dim = c(k, 1))
B0 <- diag(k)
invB0 <- matrix(c(
     1, 0, 0,
     0, 1, 0,
     0, 0, 1),
     nrow = 3, ncol = 3, byrow = TRUE)
invB0b0 <- invB0 %*% b0
output <- drawbetaOR1(z, xMat, w, tau2, theta, invB0, invB0b0)

# output$beta
#   -0.2481837 0.7837995 -3.4680418

[Package bqror version 1.7.0 Index]