Learn R Programming

ashr (version 0.9)

ash: Main Adaptive Shrinkage function

Description

Takes vectors of estimates (betahat) and their standard errors (sebetahat), and applies shrinkage to them, using Empirical Bayes methods, to compute shrunk estimates for beta.

Usage

ash(betahat, sebetahat, mixcompdist = c("uniform", "halfuniform", "normal"), df = NULL, ...)

Arguments

betahat
a p vector of estimates
sebetahat
a p vector of corresponding standard errors
mixcompdist
distribution of components in mixture ( "uniform","halfuniform" or "normal"), the default is "uniform". If you believe your effects may be asymmetric, use "halfuniform". The use of "normal" is permitted only if df=NULL.
df
appropriate degrees of freedom for (t) distribution of betahat/sebetahat, default is NULL which is actually treated as infinity (Gaussian)

Value

ash returns an object of class "ash", a list with the following elements(or a simplified list, if $onlylogLR=TRUE$, $minimaloutput=TRUE$ or $multiseqoutput=TRUE$)

Details

This function is actually just a simple wrapper that passes its parameters to ash.workhorse which provides more documented options for advanced use. See readme for more details.

See Also

ash.workhorse for complete specification of ash function

ashci for computation of credible intervals after getting the ash object return by ash()

ashm for Multi-model Adaptive Shrinkage function

Examples

Run this code
beta = c(rep(0,100),rnorm(100))
sebetahat = abs(rnorm(200,0,1))
betahat = rnorm(200,beta,sebetahat)
beta.ash = ash(betahat, sebetahat)
summary(beta.ash)
plot(betahat,beta.ash$PosteriorMean,xlim=c(-4,4),ylim=c(-4,4))

CIMatrix=ashci(beta.ash,level=0.95)
print(CIMatrix)

#Illustrating the non-zero mode feature
betahat=betahat+5
beta.ash = ash(betahat, sebetahat)
plot(betahat,beta.ash$PosteriorMean)
summary(beta.ash)
betan.ash=ash(betahat, sebetahat,nonzeromode=TRUE)
plot(betahat, betan.ash$PosteriorMean)
summary(betan.ash)

Run the code above in your browser using DataLab