ashci {ashr} | R Documentation |
Credible Interval Computation for the ash object
Description
Given the ash object returned by the main function ash, this function computes a posterior credible interval (CI) for each observation. The ash object must include a data component to use this function (which it does by default).
Usage
ashci(
a,
level = 0.95,
betaindex,
lfsr_threshold = 1,
tol = 0.001,
trace = FALSE
)
Arguments
a |
the fitted ash object |
level |
the level for the credible interval, (default=0.95) |
betaindex |
a vector consisting of locations of betahat where you would like to compute the credible interval |
lfsr_threshold |
a scalar, if specified then computes CIs only for observations more significant than that threshold. |
tol |
passed to uniroot; indicates desired accuracy. |
trace |
a logical variable denoting whether some of the intermediate results of iterations should be displayed to the user. Default is FALSE. |
Details
Uses uniroot to find credible interval, one at a time for each observation. The computation cost is linear in number of observations.
Value
A matrix, with 2 columns, ith row giving CI for ith observation
Examples
beta = c(rep(0,20),rnorm(20))
sebetahat = abs(rnorm(40,0,1))
betahat = rnorm(40,beta,sebetahat)
beta.ash = ash(betahat, sebetahat)
CImatrix=ashci(beta.ash,level=0.95)
CImatrix1=ashci(beta.ash,level=0.95,betaindex=c(1,2,5))
CImatrix2=ashci(beta.ash,level=0.95,lfsr_threshold=0.1)