Estimands
This package defines dedicated types to describe empirical Bayes estimands (that can be used for estimation or inference).
Empirikos.EBayesTarget
— TypeAbstract type that describes Empirical Bayes estimands (which we want to estimate or conduct inference for).
Example: PosteriorMean
Empirikos.PosteriorMean
— TypePosteriorMean(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))
PosteriorMean{StandardNormalSample{Float64}}(Z= 1.0 | σ=1.0 )
julia> postmean1(G)
0.5
julia> postmean2 = PosteriorMean(NormalSample(1.0, sqrt(3.0)))
PosteriorMean{NormalSample{Float64,Float64}}(Z= 1.0 | σ=1.732)
julia> postmean2(G)
0.25000000000000006
Posterior estimands
In addition to PosteriorMean
, other implemented posterior estimands are the following:
Empirikos.PosteriorProbability
— TypePosteriorProbability(Z::EBayesSample, s) <: AbstractPosteriorTarget
Type representing the posterior probability, i.e.,
\[\Prob_G[\mu_i \in s \mid Z_i = z]\]
Empirikos.PosteriorVariance
— TypePosteriorVariance(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:
Empirikos.LinearEBayesTarget
— TypeLinearEBayesTarget <: EBayesTarget
Abstract type that describes Empirical Bayes estimands that are linear functionals of the prior G
.
Currently available linear functionals:
Empirikos.PriorDensity
— TypePriorDensity(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)
.
Empirikos.MarginalDensity
— TypeMarginalDensity(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) = \varhi \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':
Base.numerator
— MethodBase.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)$.
Base.denominator
— MethodBase.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)
.