rvaluesMCMC {rvalues} | R Documentation |
R-values from MCMC output.
Description
Returns r-values from an array of MCMC output.
Usage
rvaluesMCMC(output, qtheta, alpha.grid = NULL, ngrid = NULL, smooth = "none")
Arguments
output |
a matrix contatining mcmc ouput. The ith row should represent a sample from the posterior of the ith parameter of interest. |
qtheta |
either a function which returns the quantiles (for upper tail probs.) of theta or a vector of theta-quantiles. |
alpha.grid |
grid of values in (0,1); used for the discrete approximation approach for computing r-values. |
ngrid |
number of grid points for alpha.grid; only relevant when |
smooth |
either |
Value
An object of class "rvals" which is a list containing at least the following components:
main |
a data frame containing the r-values, the r-value rankings along with the rankings from several other common procedures |
aux |
a list containing other extraneous information |
rvalues |
a vector of r-values |
Author(s)
Nicholas Henderson and Michael Newton
References
Henderson, N.C. and Newton, M.A. (2016). Making the cut: improved ranking and selection for large-scale inference. J. Royal Statist. Soc. B., 78(4), 781-804. doi: 10.1111/rssb.12131 https://arxiv.org/abs/1312.5776
See Also
Examples
data(MCMCtest)
### For the MCMC output in MCMC_test, the prior assumed for the effect sizes of
### interest was a mixture of two t-distributions. The function qthetaTMix
### computes the quantiles for this prior.
qthetaTMix <- function(p) {
### function to compute quantiles (for upper tail probabilities) for a
### mixture of two t-distributions
mu <- c(.35,-.12)
sig <- c(.2,.08)
mix.prop <- c(.25,.75)
ff <- function(x,pp) {
prob_less <- 0
for(k in 1:2) {
prob_less <- prob_less + pt((x - mu[k])/sig[k],df=4,lower.tail=FALSE)*mix.prop[k]
}
return(prob_less - pp)
}
nn <- length(p)
ans <- numeric(nn)
for(i in 1:nn) {
ans[i] <- uniroot(ff,interval=c(-5,5),tol=1e-6,pp=p[i])$root
}
return(ans)
}
rvs <- rvaluesMCMC(MCMCtest, qtheta = qthetaTMix)