Description Usage Arguments Details Value See Also Examples
Takes vectors of estimates (betahat
) and their
standard errors (sebetahat
) or a list of mixture error
distributions (errordist
), and applies shrinkage to them,
using Empirical Bayes methods, to compute shrunk estimates for
beta. This is the more detailed version of stramash for "research"
use. Most users will be happy with the stramash
function, which
provides the same usage, but documents only the main options
for simplicity.
1 2 3 4 5 6 7 8 | stramash.workhorse(betahat, errordist = NULL, sebetahat = NULL,
likelihood = c("normal", "t", "laplace"), gridsize = 100,
method = c("fdr", "shrink"), mixcompdist = c("uniform", "halfuniform",
"normal", "+uniform", "-uniform"), optmethod = c("mixIP", "mixEM",
"mixVBEM"), df = NULL, randomstart = FALSE, nullweight = 10,
nonzeromode = FALSE, pointmass = NULL, prior = c("nullbiased",
"uniform", "unit"), mixsd = NULL, gridmult = sqrt(2), outputlevel = 2,
g = NULL, fixg = FALSE, model = c("EE", "ET"), control = list())
|
betahat |
a p vector of estimates |
errordist |
A list of objects of either class
|
sebetahat |
a p vector of corresponding standard errors |
likelihood |
One of the pre-specified likelihoods
available. So far, they are |
gridsize |
The size of the grid if you are using one of the pre-specified likelihoods. |
method |
specifies how stramash is to be run. Can be
|
mixcompdist |
distribution of components in mixture
( |
optmethod |
specifies optimization method used. Default is
|
df |
appropriate degrees of freedom for (t) distribution of
betahat/sebetahat if |
randomstart |
logical, indicating whether to initialize EM
randomly. If |
nullweight |
scalar, the weight put on the prior under
|
nonzeromode |
logical, indicating whether to use a non-zero
unimodal mixture(default is |
pointmass |
logical, indicating whether to use a point mass at zero as one of components for a mixture distribution |
prior |
string, or numeric vector indicating Dirichlet prior
on mixture proportions (defaults to |
mixsd |
vector of standard deviations for underlying mixture components for the prior. |
gridmult |
the multiplier by which the default grid values for mixsd differ by one another. (Smaller values produce finer grids). |
outputlevel |
determines amount of output [ |
g |
the prior distribution for beta (usually estimated from the data; this is used primarily in simulated data to do computations with the "true" g) |
fixg |
if |
model |
|
control |
A list of control parameters for the optmization
algorithm. Default value is set to be |
See README.md for more details.
stramash returns an object of class
"ash", a list
with some or all of the following elements (determined by outputlevel)
fitted.g |
fitted mixture, either a normalmix or unimix |
loglik |
log P(D|mle(pi)) |
logLR |
log[P(D|mle(pi))/P(D|beta==0)] |
PosteriorMean |
A vector consisting the posterior mean of beta from the mixture |
PosteriorSD |
A vector consisting the corresponding posterior standard deviation |
PositiveProb |
A vector of posterior probability that beta is positive |
NegativeProb |
A vector of posterior probability that beta is negative |
ZeroProb |
A vector of posterior probability that beta is zero |
lfsr |
The 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 |
call |
a call in which all of the specified arguments are specified by their full names |
excludeindex |
the vector of index of observations with 0 standard error; if none, then returns NULL |
model |
either "EE" or "ET", denoting whether exchangeable effects (EE) or exchangeable T stats (ET) has been used |
optmethod |
the optimization method used |
data |
a list consisting the input betahat and sebetahat (only included if outputlevel>2) |
fit |
a list containing results of mixture optimization, and matrix of component log-likelihoods used in this optimization |
stramash
for simplified specification of
stramash function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | beta = c(rep(0, 100), stats::rnorm(100))
sebetahat = abs(stats::rnorm(200, 0, 1))
betahat = stats::rnorm(200, beta, sebetahat)
beta.stramash = stramash.workhorse(betahat = betahat, sebetahat = sebetahat)
names(beta.stramash)
summary(beta.stramash)
head(as.data.frame(beta.stramash))
graphics::plot(betahat, beta.stramash$PosteriorMean, xlim=c(-4, 4), ylim=c(-4, 4))
## Testing the non-zero mode feature
betahat = betahat + 5
beta.stramash = stramash.workhorse(betahat = betahat, sebetahat = sebetahat)
graphics::plot(betahat, beta.stramash$PosteriorMean)
summary(beta.stramash)
## Running stramash with a pre-specified g, rather than estimating it
beta = c(rep(0, 100), stats::rnorm(100))
sebetahat = abs(stats::rnorm(200, 0, 1))
betahat = stats::rnorm(200, beta, sebetahat)
true_g = ashr::normalmix(c(0.5, 0.5), c(0, 0), c(0, 1)) # define true g
## Passing this g into stramash causes it to
## i) take the sd and the means for each component from this g, and
## ii) initialize pi to the value from this g.
beta.stramash = stramash.workhorse(betahat = betahat, sebetahat = sebetahat,
g = true_g, fixg = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.