logMargLikeOR1: Marginal likelihood in the OR1 model

View source: R/ORI.R

logMargLikeOR1R Documentation

Marginal likelihood in the OR1 model

Description

This function computes the logarithm of marginal likelihood in the OR1 model (ordinal quantile model with 3 or more outcomes) using the MCMC outputs from the complete and reduced runs.

Usage

logMargLikeOR1(y, x, b0, B0, d0, D0, postMeanbeta,
postMeandelta, betadraws, deltadraws, tune, Dhat, p, 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.

postMeanbeta

posterior mean of \beta from the complete MCMC run.

postMeandelta

posterior mean of \delta from the complete MCMC run.

betadraws

a dataframe with all the sampled values for \beta from the complete MCMC run.

deltadraws

a dataframe with all the sampled values for \delta from the complete MCMC run.

tune

tuning parameter to adjust the MH acceptance rate.

Dhat

negative inverse Hessian from the maximization of log-likelihood.

p

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

verbose

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

Details

This function computes the logarithm of marginal likelihood in the OR1 model using the MCMC outputs from complete and reduced runs.

Value

Returns an estimate of log marginal likelihood

References

Chib, S. (1995). “Marginal likelihood from the Gibbs output.” Journal of the American Statistical Association, 90(432):1313–1321, 1995. DOI: 10.1080/01621459.1995.10476635

Chib, S., and Jeliazkov, I. (2001). “Marginal likelihood from the Metropolis-Hastings output.” Journal of the American Statistical Association, 96(453):270–281, 2001. DOI: 10.1198/016214501750332848

See Also

mvnpdf, dnorm, Gibbs sampling, 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 = FALSE)
# output$logMargLike
#   -554.61


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

Related to logMargLikeOR1 in bqror...