dicOR1: Deviance Information Criterion in the OR1 model

View source: R/ORI.R

dicOR1R Documentation

Deviance Information Criterion in the OR1 model

Description

Function for computing the Deviance Information Criterion (DIC) in the OR1 model (ordinal quantile model with 3 or more outcomes).

Usage

dicOR1(y, x, betadraws, deltadraws, postMeanbeta, postMeandelta, burn, mcmc, p)

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.

betadraws

dataframe of the MCMC draws of \beta, size is (k x nsim).

deltadraws

dataframe of the MCMC draws of \delta, size is ((J-2) x nsim).

postMeanbeta

posterior mean of the MCMC draws of \beta.

postMeandelta

posterior mean of the MCMC draws of \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).

Details

Deviance is -2*(log likelihood) and has an important role in statistical model comparison because of its relation with Kullback-Leibler information criterion.

This function provides the DIC, which can be used to compare two or more models at the same quantile. The model with a lower DIC provides a better fit.

Value

Returns a list with components

DIC = 2*avgdDeviance - dev

pd = avgdDeviance - dev

dev = -2*(logLikelihood)

.

References

Spiegelhalter, D. J., Best, N. G., Carlin, B. P. and Linde, A. (2002). “Bayesian Measures of Model Complexity and Fit.” Journal of the Royal Statistical Society B, Part 4: 583-639. DOI: 10.1111/1467-9868.00353

Gelman, A., Carlin, J. B., Stern, H. S., and Rubin, D. B. “Bayesian Data Analysis.” 2nd Edition, Chapman and Hall. DOI: 10.1002/sim.1856

See Also

decision criteria

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)
mcmc <- 40
deltadraws <- output$deltadraws
betadraws <- output$betadraws
burn <- 0.25*mcmc
nsim <- burn + mcmc
postMeanbeta <- output$postMeanbeta
postMeandelta <- output$postMeandelta
dic <- dicOR1(y, xMat, betadraws, deltadraws,
postMeanbeta, postMeandelta, burn, mcmc, p = 0.25)

# DIC
#   1375.329
# pd
#   139.1751
# dev
#   1096.979


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

Related to dicOR1 in bqror...