| ebci {ebci} | R Documentation |
Compute empirical Bayes confidence intervals by shrinking toward regression
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
ebci(
formula,
data,
se,
weights = NULL,
alpha = 0.1,
kappa = NULL,
wopt = FALSE,
fs_correction = "PMT"
)
Arguments
formula |
object of class |
data |
optional data frame, list or environment (or object coercible by
|
se |
Standard errors |
weights |
An optional vector of weights to be used in the fitting
process in computing |
alpha |
Determines confidence level, |
kappa |
If non- |
wopt |
If |
fs_correction |
Finite-sample correction method used to compute
|
Value
Returns a list with the following components:
mu2Estimated 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 byfs_correction, the second element is the uncorrected estimate.kappaEstimated kurtosis
\kappaof\theta-X'\delta. Vector of length 2 with the same structure asmu2.deltaEstimated regression coefficients
\deltaXMatrix of regressors
alphaDetermines confidence level
1-\alphaused.dfData frame with components described below.
df has the following components:
w_ebEB shrinkage factors,
\mu_{2}/(\mu_{2}+\sigma^2_i)w_optLength-optimal shrinkage factors
ncov_paMaximal non-coverage of parametric EBCIs
len_ebHalf-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_opHalf-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_paHalf-length of parametric EBCIs, which take the form
cbind(th_eb-len_pa, th_eb+len_a)len_usHalf-length of unshrunk CIs, which take the form
cbind(th_us-len_us, th_us+len_us)th_usUnshrunk estimate
Yth_ebEB estimate.
th_opEstimate based on length-optimal shrinkage.
seStandard error
\sigma, as supplied by the argumentseweightsWeights used
residualsThe 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
## 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)