Estimands

This package defines dedicated types to describe empirical Bayes estimands (that can be used for estimation or inference).

EBayesTarget

Abstract type that describes Empirical Bayes estimands (which we want to estimate or conduct inference for).

Example: PosteriorMean

PosteriorMean

PosteriorMean(Z::EBayesSample) <: AbstractPosteriorTarget

Type representing the posterior mean, i.e.,

\[ E_G[\mu_i \mid Z_i = z] \]

A target::EBayesTarget, such as PosteriorMean, may be used as a callable on distributions (priors).

julia> G = Normal()
Normal{Float64}(μ=0.0, σ=1.0)

julia> postmean1 = PosteriorMean(StandardNormalSample(1.0))
julia> postmean1(G)
0.5

julia> postmean2 = PosteriorMean(NormalSample(1.0, sqrt(3.0)))
julia> postmean2(G)
0.25000000000000006

Posterior estimands

In addition to PosteriorMean, other implemented posterior estimands are the following:

PosteriorProbability

PosteriorProbability(Z::EBayesSample, s) <: AbstractPosteriorTarget

Type representing the posterior probability, i.e.,

\[ \Prob_G[\mu_i \in s \mid Z_i = z] \]

PosteriorVariance

PosteriorVariance(Z::EBayesSample) <: AbstractPosteriorTarget

Type representing the posterior variance, i.e.,

\[ V_G[\mu_i \mid Z_i = z] \]

Linear functionals

A special case of empirical Bayes estimands are linear functionals:

LinearEBayesTarget

LinearEBayesTarget <: EBayesTarget

Abstract type that describes Empirical Bayes estimands that are linear functionals of the prior G.

Currently available linear functionals:

PriorDensity

PriorDensity(z::Float64) <: LinearEBayesTarget

Example call

julia> PriorDensity(2.0)
PriorDensity{Float64}(2.0)

Description

This is the evaluation functional of the density of \(G\) at z, i.e., \(L(G) = G'(z) = g(z)\) or in Julia code L(G) = pdf(G, z).

MarginalDensity

MarginalDensity(Z::EBayesSample) <: LinearEBayesTarget

Example call

MarginalDensity(StandardNormalSample(2.0))

Description

Describes the marginal density evaluated at \(Z=z\) (e.g. \(Z=2\) in the example above). In the example above the sample is drawn from the hierarchical model

\[ \mu \sim G, Z \sim \mathcal{N}(0,1) \]

In other words, letting \(\varphi\) the Standard Normal pdf

\[ L(G) = \varphi \star dG(z) \]

Note that 2.0 has to be wrapped inside StandardNormalSample(2.0) since this target depends not only on G and the location, but also on the likelihood.

Posterior estimands such as PosteriorMean can be typically decomposed into two linear functionals, a numerator and a denominator:

numerator

numerator(x)

Numerator of the rational representation of x.

Examples

julia> numerator(2//3)
2

julia> numerator(4)
4
Base.numerator(target::AbstractPosteriorTarget)

Suppose a posterior target \(\theta_G(z)\), such as the posterior mean can be written as:

\[ \theta_G(z) = \frac{ a_G(z)}{f_G(z)} = \frac{ \int h(\mu)dG(\mu)}{\int p(z \mid \mu)dG(\mu)}. \]

For example, for the posterior mean \(h(\mu) = \mu \cdot p(z \mid \mu)\). Then Base.numerator returns the linear functional representing \(G \mapsto a_G(z)\).

denominator

denominator(x)

Denominator of the rational representation of x.

Examples

julia> denominator(2//3)
3

julia> denominator(4)
1
Base.denominator(target::AbstractPosteriorTarget)

Suppose a posterior target \(\theta_G(z)\), such as the posterior mean can be written as:

\[ \theta_G(z) = \frac{ a_G(z)}{f_G(z)} = \frac{ \int h(\mu)dG(\mu)}{\int p(z \mid \mu)dG(\mu)}. \]

For example, for the posterior mean \(h(\mu) = \mu \cdot p(z \mid \mu)\). Then Base.denominator returns the linear functional representing \(G \mapsto f_G(z)\) (i.e., typically the marginal density). Also see Base.numerator(::AbstractPosteriorTarget).