Confidence intervals
The basic function to construct confidence intervals is the following
StatsBase.confint
— MethodStatsBase.confint(target::EBayesTarget, estimator, Zs;
level = 0.9, clip = true)
Construct confidence intervals for target
based on samples Zs
with the estimator estimator
. The nominal coverage is set to level
. If clip=true
(Default) and target
is bounded (say in $[0,1]$), then the confidence intervals are clipped so as to satisfy these bounds.
Some of the estimators have already been fitted on the Zs
, so that the following call is also possible:
StatsBase.confint(target::EBayesTarget, estimator;
level = 0.9, clip = true)
Note that when the estimator is a SteinMinimaxEstimator
, it is typically assumed that Zs
is derived from data that is separate from the bata used in the construction of the quasi-minimax estimator.
Typical workflow
A typical workflow looks as follows (see data analysis tutorial for two examples):
First, set up a MinimaxCalibratorOptions
instance:
mceb_options = MinimaxCalibratorOptions(prior_class = ..., marginal_grid = ..., pilot_options = ...)
Next fit mceb_options
to the data and thereby construct a MinimaxCalibratorSetup
object. This contains for example the fitted KDEInfinityBand
.
mceb_setup = fit(mceb_options, nbhood_Zs)
Next for a given empirical Bayes target, we compute its pilot estimator, as well as the minimax linear estimator for the calibrated target:
target = PosteriorMean(StandardNormalSample(1.0))
calibrated_estimator_fit = fit(mceb_setup, target)
Finally we can compute confidence interval as
confint(target, calibrated_estimator_fit)
Reference
MinimaxCalibratedEBayes.MinimaxCalibratorOptions
— TypeMinimaxCalibratorOptions(split = :random
prior_class::ConvexPriorClass,
marginal_grid,
infinity_band_options,
pilot_options,
tuner = HalfCIWidth
cache_target = false)
Struct that wraps all options required to automatically create a MinimaxCalibratorSetup
object. The options are as follows
split
: Defaults to:random
, i.e., a random 50-50 split of the data.prior_class
: AConvexPriorClass
in which the true $G$ is believed to lie.marginal_grid
: Marginal domain discretization grid.infinity_band_options
: Options for constructing the localization, cf.KDKDEInfinityBandOptions
.pilot_options
: Options that describe how to derive the pilot estimators, for exampleButuceaComteOptions
.tuner
: Specifies how the bias-variance tradeoff (i.e., $\delta$) will be navigated, for exampleRMSE
orHalfCIWidth
.cache_target
: Defaults tofalse
. Setting it totrue
will speed up computations when multiple similar targets are being estimated (e.g., PosteriorMeans along a grid).
MinimaxCalibratedEBayes.MinimaxCalibratorSetup
— TypeMinimaxCalibratorSetup(;Zs_test,
Zs_train,
fkde_train,
prior_class,
Zs_test_discr,
delta_tuner,
pilot_method,
cache_target)
Description:
This creates the object that holds all preliminary calculations necessary to conduct inference for empirical Bayes estimands. It can be either constructed manually, or more typically through fit(opt::MinimaxCalibratorOptions, Zs)
where Zs
comprises all the data and opt
is a MinimaxCalibratorOptions
object. See data_analysis.html
for examples of both approaches.
Arguments:
Zs_test
: Samples in the second data fold.Zs_train
: Samples in the first data fold.fkde_train
: AKDEInfinityBand
instance computed based onZs_train
or external data (but notZs_test
).Zs_test_discr
: A discretization ofZs_test
intoDiscretizedStandardNormalSamples
.delta_tuner
: Specifies how the bias-variance tradeoff (i.e., $\delta$) will be navigated, for exampleRMSE
orHalfCIWidth
.pilot_method
: Method for computing the pilot estimator for the numerator and denominator of the empirical Bayes estimand. Should support the interfaceestimate(target::LinearEBayesTarget, pilot_method, Zs_train)
.cache_target
: Defaults tofalse
. Setting it totrue
will speed up computations when multiple similar targets are being estimated (e.g., PosteriorMeans along a grid).