Description Usage Arguments Value Author(s) References See Also Examples
Returns r-values from an array of MCMC output.
1 | rvaluesMCMC(output, qtheta, alpha.grid = NULL, ngrid = NULL, smooth = "none")
|
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 |
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 |
Nicholas Henderson and Michael Newton
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.