ebayesthresh {EbayesThresh} | R Documentation |
Given a sequence of data, performs Empirical Bayes thresholding, as discussed in Johnstone and Silverman (2004).
ebayesthresh(x, prior = "laplace", a = 0.5, bayesfac = FALSE, sdev = NA, verbose = FALSE, threshrule = "median")
x |
vector of data values |
prior |
specification of prior to be used
conditional on the mean being nonzero;
can be cauchy or laplace
|
a |
scale factor if Laplace prior is used.
Ignored if Cauchy prior is used.
If, on entry, a=NA and prior="laplace" , then the scale
parameter will also be estimated by marginal maximum likelihood.
If a is not specified then the default value 0.5 will be used.
|
bayesfac |
if bayesfac=TRUE , then whenever a threshold is explicitly
calculated, the Bayes factor threshold will be used
|
sdev |
the sampling standard deviation of the data x .
If, on entry, sdev=NA , then the standard deviation will be
estimated using the median absolute deviation from zero,
as mad(x, center=0) .
|
verbose |
controls the level of output. See below. |
threshrule |
specifies the thresholding rule to be applied to the data.
Possible values are median (use the posterior median);
mean (use the posterior mean);
hard (carry out hard thresholding);
soft (carry out soft thresholding);
none (find various parameters, but do not carry out any thresholding).
|
It is assumed that the data vector (x_1, ..., x_n) is such that each x_i is drawn independently from a normal distribution with mean theta_i and variance σ^2. The prior distribution of each theta_i is a mixture with probability 1-w of zero and probability w of a given symmetric heavy-tailed distribution. The mixing weight w is estimated by marginal maximum likelihood. Given the mixing weight, and possibly a scale factor in the symmetric distribution, are estimated by marginal maximum likelihood. The resulting values are used as the hyperparameters in the prior.
The parameters can be estimated as the posterior median or the posterior mean given the data, or by hard or soft thresholding using the posterior median threshold. If hard or soft thresholding is chosen, then there is the additional choice of using the Bayes factor threshold, which is the value such that the posterior probability of zero is exactly half if the data value is equal to the threshold.
If verbose=FALSE
, a vector giving the values of the estimates of the underlying mean vector.
If verbose=TRUE
, a list with the following elements:
muhat |
the estimated mean vector (omitted if threshrule="none" ) |
x |
the data vector as supplied |
threshold.sdevscale |
the threshold as a multiple of the standard deviation sdev |
threshold.origscale |
the threshold measured on the original scale of the data |
prior |
the prior that was used |
w |
the mixing weight as estimated by marginal maximum likelihood |
a |
(only present if Laplace prior used) the scale factor as supplied or estimated |
bayesfac |
the value of the parameter bayesfac , determining whether Bayes factor or posterior median thresholds are used |
sdev |
the standard deviation of the data as supplied or estimated |
threshrule |
the thresholding rule used, as specified above |
Bernard Silverman
Johnstone, I. M. and Silverman, B. W. (2004) Needles and straw in haystacks: Empirical Bayes estimates of possibly sparse sequences. Annals of Statistics, 32, 1594–1649.
Johnstone, I. M. and Silverman, B. W. (2004) EbayesThresh: R software for Empirical Bayes thresholding. Journal of Statistical Software. To appear.
Johnstone, I. M. (2004) `Function Estimation and Classical Normal Theory' `The Threshold Selection Problem'. The Wald Lectures I and II, 2004. Available from http://www-stat.stanford.edu/~imj/.
Johnstone, I. M. and Silverman, B. W. (2005) Empirical Bayes selection of wavelet thresholds. Annals of Statistics, 33, to appear.
The papers by Johnstone and Silverman are available from http://www.bernardsilverman.com.
See also http://www-stat.stanford.edu/~imj/ for further references, including the draft of a monograph by I. M. Johnstone.
ebayesthresh(x=rnorm(100, c( rep(0,90), rep(5,10))), prior="cauchy", sdev=NA)