Compute Credible Intervals for BAS regression coefficients from BAS objects
Source:R/confint.R
confint.coef.Rd
Uses Monte Carlo simulations using posterior means and standard deviations of coefficients to generate draws from the posterior distributions and returns highest posterior density (HPD) credible intervals. If the number of models equals one, then use the t distribution to find intervals. These currently condition on the estimate of $g$. than the description above ~~
Arguments
- object
a coef.bas object
- parm
a specification of which parameters are to be given credible intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered.
- level
the probability coverage required
- nsim
number of Monte Carlo draws from the posterior distribution. Used when number of models is greater than 1.
- ...
other arguments to passed; none currently
Value
A matrix (or vector) with columns giving lower and upper HPD credible limits for each parameter. These will be labeled as 1-level)/2 and 1 - (1-level)/2 in percent (by default 2.5 and 97.5).
Note
For mixture of g-priors these are approximate. This uses Monte Carlo sampling so results may be subject to Monte Carlo variation and larger values of nsim may be needed to reduce variability.
See also
Other CI methods:
confint.pred.bas()
,
plot.confint.bas()
Other bas methods:
BAS
,
bas.lm()
,
coef.bas()
,
confint.pred.bas()
,
diagnostics()
,
fitted.bas()
,
force.heredity.bas()
,
image.bas()
,
plot.confint.bas()
,
predict.bas()
,
predict.basglm()
,
summary.bas()
,
update.bas()
,
variable.names.pred.bas()
Examples
data("Hald")
hald_gprior <- bas.lm(Y~ ., data=Hald, alpha=13,
prior="g-prior")
coef_hald <- coef(hald_gprior)
confint(coef_hald)
#> 2.5% 97.5% beta
#> Intercept 93.853573 96.9385987 95.4230769
#> X1 0.000000 1.8615960 1.2150202
#> X2 -1.154011 0.8918842 0.2756235
#> X3 -1.556924 0.5528633 -0.1270575
#> X4 -1.750152 0.2381370 -0.3268710
#> attr(,"Probability")
#> [1] 0.95
#> attr(,"class")
#> [1] "confint.bas"
confint(coef_hald, approx=FALSE, nsim=5000)
#> 2.5% 97.5% beta
#> Intercept 93.872680 96.9519316 95.4230769
#> X1 0.000000 1.8751054 1.2150202
#> X2 -1.078786 0.8984255 0.2756235
#> X3 -1.525466 0.5581576 -0.1270575
#> X4 -1.654676 0.2717885 -0.3268710
#> attr(,"Probability")
#> [1] 0.95
#> attr(,"class")
#> [1] "confint.bas"
# extract just the coefficient of X4
confint(coef_hald, parm="X4")
#> 2.5% 97.5% beta
#> X4 -1.654426 0.3677784 -0.326871
#> attr(,"Probability")
#> [1] 0.95
#> attr(,"class")
#> [1] "confint.bas"