rscaleUsage: MCMC Algorithm for Multivariate Ordinal Data with Scale Usage...

View source: R/rscaleusage_rcpp.r

rscaleUsageR Documentation

MCMC Algorithm for Multivariate Ordinal Data with Scale Usage Heterogeneity

Description

rscaleUsage implements an MCMC algorithm for multivariate ordinal data with scale usage heterogeniety.

Usage

rscaleUsage(Data, Prior, Mcmc)

Arguments

Data

list(x, k)

Prior

list(nu, V, mubar, Am, gs, Lambdanu, LambdaV)

Mcmc

list(R, keep, nprint, ndghk, e, y, mu, Sigma, sigma, tau, Lambda)

Details

Model and Priors

n = nrow(x) individuals respond to p = ncol(x) questions; all questions are on a scale 1, \ldots, k for respondent i and question j,

x_{ij} = d if c_{d-1} \le y_{ij} \le c_d where d = 1, \ldots, k and c_d = a + bd + ed^2

y_i = mu + tau_i*iota + sigma_i*z_i with z_i \sim N(0, Sigma)

(tau_i, ln(sigma_i)) \sim N(\phi, Lamda)
\phi = (0, lambda_{22})
mu \sim N(mubar, Am^{-1})
Sigma \sim IW(nu, V)
Lambda \sim IW(Lambdanu, LambdaV)
e \sim unif on a grid

It is highly recommended that the user choose the default prior settings. If you wish to change prior settings and/or the grids used, please carefully read the case study listed in the reference below.

Argument Details

Data = list(x, k)

x: n x p matrix of discrete responses
k: number of discrete rating scale options

Prior = list(nu, V, mubar, Am, gs, Lambdanu, LambdaV) [optional]

nu: d.f. parameter for Sigma prior (def: p + 3)
V: scale location matrix for Sigma prior (def: nu*I)
mubar: p x 1 vector of prior means (def: rep(k/2,p))
Am: p x p prior precision matrix (def: 0.01*I)
gs: grid size for sigma (def: 100)
Lambdanu: d.f. parameter for Lambda prior (def: 20)
LambdaV: scale location matrix for Lambda prior (def: (Lambdanu - 3)*Lambda)

Mcmc = list(R, keep, nprint, ndghk, e, y, mu, Sigma, sigma, tau, Lambda) [only R required]

R: number of MCMC draws (def: 1000)
keep: MCMC thinning parameter -- keep every keepth draw (def: 1)
nprint: print the estimated time remaining for every nprint'th draw (def: 100, set to 0 for no print)
ndghk: number of draws for a GHK integration (def: 100)
e: initial value (def: 0)
y: initial values (def: x)
mu: initial values (def: apply(y,2,mean), a p-length vector)
Sigma: initial value (def: var(y))
sigma: initial values (def: rep(1,n))
tau: initial values (def: rep(0,n))
Lambda: initial values (def: matrix(c(4,0,0,.5),ncol=2))

Value

A list containing:

Sigmadraw

R/keep x p*p matrix of Sigma draws – each row is the vector form of Sigma

mudraw

R/keep x p matrix of mu draws

taudraw

R/keep x n matrix of tau draws

sigmadraw

R/keep x n matrix of sigma draws

Lambdadraw

R/keep x 4 matrix of Lamda draws

edraw

R/keep x 1 vector of e draws

Warning

tau_i, sigma_i are identified from the scale usage patterns in the p questions asked per respondent (# cols of x). Do not attempt to use this on datasets with only a small number of total questions.

Author(s)

Rob McCulloch (Arizona State University) and Peter Rossi (Anderson School, UCLA), perossichi@gmail.com.

References

For further discussion, see Case Study 3 on Overcoming Scale Usage Heterogeneity, Bayesian Statistics and Marketing by Rossi, Allenby, and McCulloch.

Examples

if(nchar(Sys.getenv("LONG_TEST")) != 0) {R=1000} else {R=5} 
set.seed(66)

data(customerSat)
surveydat = list(k=10, x=as.matrix(customerSat))

out = rscaleUsage(Data=surveydat, Mcmc=list(R=R))
summary(out$mudraw)

bayesm documentation built on Sept. 24, 2023, 1:07 a.m.