R: Main Adaptive Shrinkage function

ash {ashr} | R Documentation

## Main Adaptive Shrinkage function

### Description

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

### Usage

    ash(betahat, sebetahat, mixcompdist = c("uniform", "halfuniform", "normal",
      "+uniform", "-uniform"), 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"; "+uniform" or "-uniform"), the default is "uniform". If you believe your effects may be asymmetric, use "halfuniform". If you want to allow only positive/negative effects use "+uniform"/"-uniform". 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)
`...` | Further arguments to be passed to `ash.workhorse`.

### 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.

### Value

ash returns an object of `class` "ash", a list with some or all of the following elements (determined by outputlevel)

`fitted_g` | fitted mixture
`loglik` | log P(D|fitted_g)
`logLR` | log[P(D|fitted_g)/P(D|beta==0)]
`result` | A dataframe whose columns are

NegativeProb

  A vector of posterior probability that beta is negative

PositiveProb

  A vector of posterior probability that beta is positive

lfsr

  A vector of estimated local false sign rate

lfdr

  A vector of estimated local false discovery rate

qvalue

  A vector of q values

svalue

  A vector of s values

PosteriorMean

  A vector consisting the posterior mean of beta from the mixture

PosteriorSD

  A vector consisting the corresponding posterior standard deviation

`call` | a call in which all of the specified arguments are specified by their full names
`data` | a list containing details of the data and models used (mostly for internal use)
`fit_details` | a list containing results of mixture optimization, and matrix of component log-likelihoods used in this optimization

### See Also

`ash.workhorse` for complete specification of ash function

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

### Examples

    beta = c(rep(0,100),rnorm(100))
    sebetahat = abs(rnorm(200,0,1))
    betahat = rnorm(200,beta,sebetahat)
    beta.ash = ash(betahat, sebetahat)
    names(beta.ash)
    head(beta.ash$result) # the main dataframe of results
    graphics::plot(betahat,beta.ash$result$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)
    graphics::plot(betahat,beta.ash$result$PosteriorMean)
    betan.ash=ash(betahat, sebetahat,mode=5)
    graphics::plot(betahat, betan.ash$result$PosteriorMean)
    summary(betan.ash)

[Package ashr version 2.0.5 Index]