Learn R Programming

StatMethRank (version 1.3)

mvnos.model: Multivariate Normal Order-statistics Model.

Description

Using MCMC methods to fit the MVNOS model. Please install JAGS 3.X (http://mcmc-jags.sourceforge.net) and rjags (https://cran.r-project.org/package=rjags) at first.

Usage

mvnos.model(y, p, Z, beta0 = NULL, A0 = NULL, alpha = NULL, P = NULL, BURN_IN_ITERATIONS = 1000, MAX_ITERATIONS = 10000, DRAW_CYCLE = 20)

Arguments

y
:an n*k matrix, observed data, each row is an individual's rank of items
p
:number of parameters in MVNOS model
Z
:a n*k*p array of covariates associated with all judges
beta0
:a 1*p matrix, prior normal distribution mean parameters
A0
:a p*p matrix, prior normal distribution variance-covariance matrix
alpha
:scalar, prior Wishart distribution degree of freedom
P
:a (k-1)*(k-1) matrix, prior Wishart distribution scale matrix
BURN_IN_ITERATIONS
:number of iterations to burn-in at first
MAX_ITERATIONS
:full sample iterations
DRAW_CYCLE
:reduce the full sample by draw-cycle(e.g. draw every 20th draw from the full sample)

Value

A list of Gibbs sampling traces

References

Yu, P. L. H. (2000). Bayesian analysis of order-statistics models for ranking data. Psychometrika, 65(3):281-299.

Examples

Run this code
# APA data application
# It will take about 10 minutes to run the demo.
data(APA)
y = freq2case(APA, freq.col = 1)
y = 6 - y
# number of observed judges
n = dim(y)[1]
# number of items
k = dim(y)[2]
# number of parameteros of beta
p = k
beta0 = rep(0, p)
alpha = k + 1
A0 = diag(100, ncol = p, nrow = p)
P = diag(k + 1, ncol = k - 1, nrow = k - 1)
# Construct Z
Z = array(0, dim = c(n, k, p))
for (j in 1:n)
{
   Z[j, , ] = diag(1, nrow= k, ncol = p)
}
# Total iterations of Gibbs sampling
MAX_ITERATIONS = 10000
# Number of iterations to be reduced(burnt in)
BURN_IN_ITERATIONS = 1000
# Run the model, time consuming
# output_list = mvnos.model(y, p, Z, beta0, A0, alpha, P,
# MAX_ITERATIONS = MAX_ITERATIONS, BURN_IN_ITERATIONS = BURN_IN_ITERATIONS)

Run the code above in your browser using DataLab