Learn R Programming

ashr (version 0.9)

ashm: Multi-model Adaptive Shrinkage function

Description

This is a wrapper function that takes a grid value of $alpha$ and then consider the model $betahat_j / s_j^{alpha} ~ g()$,and eqnbeta_j / s_j^alpha ~ N(0,(sebetahat^(1-alpha))^2) or student t distribution. When $alpha=0$ we have the EE model, when $alpha=1$, we have the ES model. $alpha$ should be in between 0 and 1, inclusively. This wrapper function would select the best $alpha$ and reports the ash item based on that $alpha$.

Usage

ashm(betahat, sebetahat, mixcompdist = c("uniform", "halfuniform", "normal"), df = NULL, alpha = 2, ncores = FALSE, ...)

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 value would be "uniform"
df
appropriate degrees of freedom for (t) distribution of betahat/sebetahat, default is NULL(Gaussian)
alpha
Could be a vector of grid values in interval [0,1], that this wrapper would select based on likelihood principle. Could also be a positive integer greater or equal to 2, then alpha number of grid values would be generated from [0,1], equally spaced. The default value is 2 that we compare the EE and ES model.
ncores
Whether to use parallel computing, defaults to FALSE, user could specify number of cores they would like to use. Further, if user does not specify and length(betahat)>50000, then the function would perform parallel computation using number of CPU cores on the current host.

Value

ashm returns a list of objects ashm returns a list of objects

Details

All other inputs are exactly the same as the main function ash, and would pass to the main function to evaluate the likelihood.

See Also

ash the main function that this wrapper function is calling

Examples

Run this code
beta = c(rep(0,100),rnorm(100))
sebetahat = abs(rnorm(200,0,1))
betahat = rnorm(200,beta,sebetahat)
beta.ashm = ashm(betahat, sebetahat,alpha=6)
#beta.ashm4 = ashm(betahat, sebetahat,alpha=6,ncores=4)
print(beta.ashm[[1]])  #best ash object
print(beta.ashm[[2]])  #corresponding model type
print(beta.ashm[[3]])  #log-likelihood for all models

Run the code above in your browser using DataLab