Learn R Programming

EbayesThresh (version 1.4-12)

postmean: Posterior mean estimator

Description

Given a single value or a vector of data and sampling standard deviations (sd equals 1 for Cauchy prior), find the corresponding posterior mean estimate(s) of the underlying signal value(s).

Usage

postmean(x, s, w = 0.5, prior = "laplace", a = 0.5)
postmean.laplace(x, s = 1, w = 0.5, a = 0.5)
postmean.cauchy(x, w)

Arguments

x

A data value or a vector of data.

s

A single value or a vector of standard deviations if the Laplace prior is used. If a vector, must have the same length as x. Ignored if Cauchy prior is used.

w

The value of the prior probability that the signal is nonzero.

prior

Family of the nonzero part of the prior; can be "cauchy" or "laplace".

a

The scale parameter of the nonzero part of the prior if the Laplace prior is used.

Value

If \(x\) is a scalar, the posterior mean \(E(\theta|x)\) where \(\theta\) is the mean of the distribution from which \(x\) is drawn. If \(x\) is a vector with elements \(x_1, ... , x_n\) and \(s\) is a vector with elements \(s_1, ... , s_n\) (s_i is 1 for Cauchy prior), then the vector returned has elements \(E(\theta_i|x_i, s_i)\), where each \(x_i\) has mean \(\theta_i\) and standard deviation \(s_i\), all with the given prior.

References

See ebayesthresh and http://www.bernardsilverman.com

See Also

postmed

Examples

Run this code
# NOT RUN {
postmean(c(-2,1,0,-4,8,50), w = 0.05, prior = "cauchy")
postmean(c(-2,1,0,-4,8,50), s = 1:6, w = 0.2, prior = "laplace", a = 0.3)
# }

Run the code above in your browser using DataLab