Learn R Programming

ashr (version 2.0.5)

ashci: 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 = 0.05, 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.

Value

A matrix, with 2 columns, ith row giving CI for ith observation

Details

Uses uniroot to find credible interval, one at a time for each observation. The computation cost is linear in number of observations.

Examples

Run this code
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)

Run the code above in your browser using DataLab