Skip to content

SMAC-Group/ib

Repository files navigation

R-CMD-check Last-changedate license

Bias correction via the iterative bootstrap

This is an under-development package that proposes the iterative bootstrap algorithm of Kuk (1995) and further studied by Guerrier et al (2019) and Guerrier et al (2020).

In order to install the package

## if not installed
## install.packages("remotes")
remotes::install_github("SMAC-Group/ib")

The ib package is conceived as a wrapper: an object that needs a bias correction is supplied to the ib() function. For example, for a negative binomial regression:

library(ib)
library(MASS)
fit_nb <- glm.nb(Days ~ Sex/(Age + Eth*Lrn), data = quine)
fit_ib1 <- ib(fit_nb)
summary(fit_ib1)

## correct for overdispersion with H=100
fit_ib2 <- ib(fit_nb, control=list(H=100), extra_param = TRUE)
summary(fit_ib2)

Currently we support lm, glm, glm.nb, lmer, nls and vglm classes, as shown in the example above with the overdispersion parameter of the negative binomial regression. More details are in help(ib).

On top of simulate, we also consider cases where the response variable is generated using censoring, missing at random and outliers mechanisms (see help(ibControl) for more details). For example

## suppose values above 30 are censored
quine2 <- transform(quine, Days=pmin(Days,30))
fit_nb <- glm.nb(Days ~ Sex/(Age + Eth*Lrn), data = quine2)
fit_ib1 <- ib(fit_nb, control = list(cens=TRUE, right=30))
summary(fit_ib1)

## correct for overdispersion with H=100
fit_ib2 <- ib(fit_nb, control=list(H=100, cens=TRUE, right=30), extra_param = TRUE)
summary(fit_ib2)