ebci: Compute empirical Bayes confidence intervals by shrinking...

Description Usage Arguments Value References Examples

View source: R/eb.R

Description

Computes empirical Bayes estimators based on shrinking towards a regression, and associated robust empirical Bayes confidence intervals (EBCIs), as well as length-optimal robust EBCIs.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ebci(
  formula,
  data,
  se,
  weights = NULL,
  alpha = 0.1,
  kappa = NULL,
  wopt = FALSE,
  fs_correction = "PMT"
)

Arguments

formula

object of class "formula" (or one that can be coerced to that class) of the form Y ~ predictors, where Y is a preliminary unbiased estimator, and predictors are predictors X that guide the direction of shrinkage. For shrinking toward the grand mean, use Y ~ 1, and for shrinking toward 0 use Y ~ 0

data

optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the preliminary estimator Y and the predictors. If not found in data, these variables are taken from environment(formula), typically the environment from which the function is called.

se

Standard errors sigma associated with the preliminary estimates Y

weights

An optional vector of weights to be used in the fitting process in computing delta, mu_2 and kappa. Should be NULL or a numeric vector.

alpha

Determines confidence level, 1-alpha.

kappa

If non-NULL, use pre-specified value for the kurtosis kappe of theta-X*delta (such as Inf), instead of computing it.

wopt

If TRUE, also compute length-optimal robust EBCIs. These are robust EBCIs centered at estimates with the shrinkage factor w_i chosen to minimize the length of the resulting EBCI.

fs_correction

Finite-sample correction method used to compute mu_2 and kappa. These corrections ensure that we do not shrink the preliminary estimates Y all the way to zero. If "PMT", use posterior mean truncation, if "FPLIB" use limited information Bayesian approach with a flat prior, and if "none", truncate the estimates at 0 for mu_2 and 1 for kappa.

Value

Returns a list with the following components:

mu2

Estimated second moment of theta-X*delta, mu_2. Vector of length 2, the first element corresponds to the estimate after the finite-sample correction as specified by fs_correction, the second element is the uncorrected estimate.

kappa

Estimated kurtosis kappa of theta-X*delta. Vector of length 2 with the same structure as mu2.

delta

Estimated regression coefficients delta

X

Matrix of regressors

alpha

Determines confidence level 1-α used.

df

Data frame with components described below.

df has the following components:

w_eb

EB shrinkage factors, mu_2/(mu_2+sigma^2_i)

w_opt

Length-optimal shrinkage factors

ncov_pa

Maximal non-coverage of parametric EBCIs

len_eb

Half-length of robust EBCIs based on EB shrinkage, so that the intervals take the form cbind(th_eb-len_eb, th_eb+len_eb)

len_op

Half-length of robust EBCIs based on length-optimal shrinkage, so that the intervals take the form cbind(th_op-len_op, th_op+len_op)

len_pa

Half-length of parametric EBCIs, which take the form cbind(th_eb-len_pa, th_eb+len_a)

len_us

Half-length of unshrunk CIs, which take the form cbind(th_us-len_us, th_us+len_us)

th_us

Unshrunk estimate Y

th_eb

EB estimate.

th_op

Estimate based on length-optimal shrinkage.

se

Standard error sigma, as supplied by the argument se

weights

Weights used

residuals

The residuals Y_i-X_i*delta

References

Armstrong, Timothy B., Kolesár, Michal, and Plagborg-Møller, Mikkel (2020): Robust Empirical Bayes Confidence Intervals, https://arxiv.org/abs/2004.03448

Examples

1
2
3
4
## Same specification as in empirical example in Armstrong, Kolesár
## and Plagborg-Møller (2020), but only use data on NY commuting zones
r <- ebci(theta25 ~ stayer25, data=cz[cz$state=="NY", ],
          se=se25, weights=1/se25^2)

ebci documentation built on Sept. 6, 2021, 9:10 a.m.