| Type: | Package |
| Title: | Bias Correction via Iterative Bootstrap |
| Version: | 0.2.1 |
| Description: | An implementation of the iterative bootstrap procedure of Kuk (1995) <doi:10.1111/j.2517-6161.1995.tb02035.x> to correct the estimation bias of a fitted model object. This procedure has better bias correction properties than the bootstrap bias correction technique. |
| Maintainer: | Samuel Orso <Samuel.Orso@unige.ch> |
| Depends: | R (≥ 4.0.0) |
| Imports: | betareg, lme4, Formula, MASS, Matrix, methods, Rdpack (≥0.7), stats, utils, VGAM |
| Suggests: | testthat (≥ 3.0.0), knitr, nlraa, rmarkdown |
| License: | GPL-2 |GPL-3 [expanded from: GPL (≥ 2)] |
| Encoding: | UTF-8 |
| RdMacros: | Rdpack |
| RoxygenNote: | 7.3.2 |
| URL: | https://smac-group.github.io/ib/,https://github.com/SMAC-Group/ib/ |
| BugReports: | https://github.com/SMAC-Group/ib/issues/ |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2025-09-04 13:32:09 UTC; orsos |
| Author: | Samuel Orso [aut, cre], Stéphane Guerrier [ctb], Yuming Zhang [ctb] |
| Repository: | CRAN |
| Date/Publication: | 2025-09-04 14:00:02 UTC |
Fitted-model wrappers for the iterative bootstrap (ib)
Description
S4 classes that wrap fitted model objects and attach extra metadata from theiterative bootstrap procedure.
Members:IbBetareg,IbGlm,IbLm,IbLmer,IbGlmer,IbNegbin,IbNls,IbVglm.
Details
Members include wrappers around models frombetareg,stats,lme4,MASS, andVGAM.
These classes are light wrappers: they store the corrected fitted object in@object (seegetObject) and additional information in@ib_extra (seegetExtra).
Value
Objects of the respective S4 classes.
Slots
objectThe original fitted model object, corrected by
ib.ib_extraA
listof extra metadata fromib.
See Also
getObject,getExtra,Ib,SummaryIb
Summaries forib wrappers
Description
S4 classes that wrap summary objects corresponding to theIb* classes.
Members:SummaryIbBetareg,SummaryIbGlm,SummaryIbLm,SummaryIbLmer,SummaryIbGlmer,SummaryIbNegbin,SummaryIbNls,SummaryIbVglm.
Slots
summThe
summary.*object.ib_extraA
listof extra metadata fromib.
See Also
Parametric bootstrap
Description
Method for generating parametric bootstrap estimates froma fitted model.
Usage
bootstrap(object, B = 1000, extra_param = FALSE, ...)Arguments
object | an |
B | an |
extra_param | if |
... | additional optional arguments to pass to |
Details
This method is a simple wrapper around theib methodwhere number of iterations is set to 1.
Value
Amatrix p (size of parameter) times B of bootstrapped estimates.
Author(s)
Samuel Orso
See Also
Method for extracting coefficients from an object in class union "Ib"
Description
Method for extracting coefficients from an object in class union "Ib"
Usage
## S4 method for signature 'Ib'coef(object, ...)Arguments
object | an object of class union "Ib" |
... | further arguments to pass to |
See Also
Method for extracting effects from an object in class union "Ib"
Description
Method for extracting effects from an object in class union "Ib"
Usage
## S4 method for signature 'Ib'effects(object, ...)Arguments
object | an object of class union "Ib" |
... | further arguments to pass to |
See Also
Method for extracting fitted values from an object in class union "Ib"
Description
Method for extracting fitted values from an object in class union "Ib"
Usage
## S4 method for signature 'Ib'fitted(object, ...)Arguments
object | an object of class union "Ib" |
... | further arguments to pass to |
See Also
Accessor to the object in class union "Ib"
Description
Method for obtaining estimates from fitted model withinany object of class unionIb.
Usage
getEst(x)## S4 method for signature 'Ib'getEst(x)Arguments
x | an object of class union "Ib" |
Details
This methods allow to access extra parameterestimates. Ifextra_param=TRUE, it becomes equivalenttocoef.
Value
an estimate (as ingetExtra).
See Also
Accessor to an extra part in class union "Ib"
Description
Method for obtaining a extra values generated bythe iterative bootstrap procedure withinany object of class unionIb.
Usage
getExtra(x)## S4 method for signature 'Ib'getExtra(x)Arguments
x | an object of class union "Ib" |
Value
alist with the following components:
| iteration | number of iterations (k) |
| of | value of the objective function||\hat{\pi}-\frac{1}{H}\sum_{h=1}^H\hat{\pi}_h(\hat{\theta}^{k})|| |
| estimate | value of the estimates\hat{\theta}^{k} |
| test_theta | value for difference of thetas:||\hat{\theta}^k-\hat{\theta}^{k-1}|| |
| ib_warn | optional warning message |
| boot | matrix ofH bootstrap estimates:\hat{\pi}(\hat{\theta}^k) |
See Also
Accessor to the object in class union "Ib"
Description
Method for obtaining the number of iteration from fitted model withinany object of class unionIb.
Usage
getIteration(x)## S4 method for signature 'Ib'getIteration(x)Arguments
x | an object of class union "Ib" |
Details
This methods allow to access extra information aboutthe number of iterations.
Value
a number of iterations (as ingetExtra).
See Also
Accessor to the object in class union "Ib"
Description
Method for obtaining a fitted model withinany object of class unionIb.
Usage
getObject(x)## S4 method for signature 'Ib'getObject(x)Arguments
x | an object of class union "Ib" |
See Also
Bias correction via iterative bootstrap
Description
ib is used to correct the bias of a fitted modelobjectwith the iterative bootstrap procedure.
Usage
ib(object, thetastart = NULL, control = list(...), extra_param = FALSE, ...)## S4 method for signature 'betareg'ib(object, thetastart = NULL, control = list(...), extra_param = FALSE, ...)## S4 method for signature 'glm'ib(object, thetastart = NULL, control = list(...), extra_param = FALSE, ...)## S4 method for signature 'glmerMod'ib(object, thetastart = NULL, control = list(...), extra_param = FALSE, ...)## S4 method for signature 'lm'ib(object, thetastart = NULL, control = list(...), extra_param = FALSE, ...)## S4 method for signature 'lmerMod'ib(object, thetastart = NULL, control = list(...), extra_param = FALSE, ...)## S4 method for signature 'nls'ib(object, thetastart = NULL, control = list(...), extra_param = FALSE, ...)## S4 method for signature 'vglm'ib(object, thetastart = NULL, control = list(...), extra_param = FALSE, ...)Arguments
object | an |
thetastart | an optional starting value for the iterative procedure.If |
control | a |
extra_param | if |
... | additional optional arguments (see 'Details'). |
Details
The iterative bootstrap procedure is described inKuk (1995) and furtherstudied by Guerrier et al. (2019) andGuerrier et al. (2020). Thekth iteration of thisalgorithm is
\hat{\theta}^{k} = \hat{\theta}^{k-1} + \hat{\pi} -\frac{1}{H}\sum_{h=1}^H\hat{\pi}_h(\hat{\theta}^{k-1})
fork=1,2,\ldots and where the sum is overh=1,\ldots,H.The estimate\hat{\pi} is provided by theobject.The value\hat{\pi}_h(\hat{\theta}) is a parametric bootstrapestimate where the bootstrap sample is generated from\hat{\theta}and a fixedseed (seeibControl).The greater the parameter valueH generally the better bias correctionbut the more computation it requires (seeibControl).Ifthetastart=NULL, the initial value of the procedure is\hat{\theta}^{0}=\hat{\pi}.The number of iterations are controlled bymaxit parameter ofibControl.
By default, the method correctcoefficients only. Forextra parameters, it depends on the model. These extra parameters may havesome constraints (e.g. positivity). Ifconstraint=TRUE (seeibControl), then a transformation from the constraint space to thereal is used for the update.
Forbetareg,extra_param is not availableas by default mean and precision parameters are corrected.Currently the 'identity' link function is not supported for precisionparameters.
Forglm, ifextra_param=TRUE: the shape parameter for theGamma, the variance of the residuals inlm orthe overdispersion parameter of the negative binomial regression inglm.nb,are also corrected. Note that thequasi familiesare not supported for the moment as they have no simulation method(seesimulate). Bias correction for extra parametersof theinverse.gaussian is not yet implemented.
Forglmer, by default, only the fixed effects are corrected.Ifextra_param=TRUE: all the random effects(variances and correlations) are also corrected.
Forlm, ifextra_param=TRUE: the variance of the residuals isalso corrected. Note that using theib is not useful as coefficientsare already unbiased, unless one considers differentdata generating mechanism such as censoring, missing valuesand outliers (seeibControl).
Forlmer, by default, only the fixed effects are corrected.Ifextra_param=TRUE: all the random effects(variances and correlations) and the varianceof the residuals are also corrected.Note that using theib iscertainly not useful with the argumentREML=TRUE inlmer as the bias of variance components isalready addressed, unless one considers differentdata generating mechanism such as censoring, missing valuesand outliers (seeibControl).
Fornls, ifextra_param=TRUE: the variance of the residuals isalso corrected.
Forvglm,extra_param is currently not used.Indeed, the philosophy of a vector generalized linear model is topotentially model all parameters of a distribution with a linear predictor.Hence, what would be considered as an extra parameter inglmfor instance, may already be captured by the defaultcoefficients.However, correcting the bias of acoefficients does not implythat the bias of the parameter of the distribution is corrected(byJensen's inequality),so we may use this feature in a future version of the package.Note that we currently only support distributionswith asimslot (seesimulate.vlm).
Value
A fitted modelobject of classIb.
Author(s)
Samuel Orso
References
Guerrier S, Dupuis-Lozeron E, Ma Y, Victoria-Feser M (2019).“Simulation-Based Bias Correction Methods for Complex Models.”Journal of the American Statistical Association,114(525), 146-157.doi:10.1080/01621459.2017.1380031, https://doi.org/10.1080/01621459.2017.1380031.
Guerrier S, Karemera M, Orso S, Victoria-Feser M, Zhang Y (2020).“A General Approach for Simulation-based Bias Correction in High Dimensional Settings.”https://arxiv.org/pdf/2010.13687.pdf.Version 2: 13 Nov 2020, 2010.13687,https://arxiv.org/pdf/2010.13687.pdf.
Kuk AYC (1995).“Asymptotically Unbiased Estimation in Generalized Linear Models with Random Effects.”Journal of the Royal Statistical Society: Series B (Methodological),57(2), 395-407.doi:10.1111/j.2517-6161.1995.tb02035.x, https://rss.onlinelibrary.wiley.com/doi/pdf/10.1111/j.2517-6161.1995.tb02035.x,https://rss.onlinelibrary.wiley.com/doi/abs/10.1111/j.2517-6161.1995.tb02035.x.
See Also
Examples
## beta regressionlibrary(betareg)data("GasolineYield", package = "betareg")## currently link.phi = "identity" is not supported## fit_beta <- betareg(yield ~ batch + temp, data = GasolineYield)fit_beta <- betareg(yield ~ batch + temp, link.phi = "log", data = GasolineYield)fit_ib <- ib(fit_beta)# precision parameter can also depend on covariatesfit_beta <- betareg(yield ~ batch + temp | temp, data = GasolineYield)fit_ib <- ib(fit_beta)## poisson regressioncounts <- c(18,17,15,20,10,20,25,13,12)outcome <- gl(3,1,9)treatment <- gl(3,3)pois_fit <- glm(counts ~ outcome + treatment, family = poisson())fit_ib <- ib(pois_fit)summary(fit_ib)## Set H = 1000## Not run: fit_ib <- ib(pois_fit, control=list(H=1000))summary(fit_ib)## End(Not run)## gamma regressionclotting <- data.frame( u = c(5,10,15,20,30,40,60,80,100), lot1 = c(118,58,42,35,27,25,21,19,18), lot2 = c(69,35,26,21,18,16,13,12,12))fit_gamma <- glm(lot2 ~ log(u), data = clotting, family = Gamma(link = "inverse"))fit_ib <- ib(fit_gamma)## summary(fit_ib)## correct for shape parameter and show iterations## Not run: fit_ib <- ib(fit_gamma, control=list(verbose=TRUE), extra_param = TRUE)summary(fit_ib)## End(Not run)## negative binomial regressionlibrary(MASS)fit_nb <- glm.nb(Days ~ Sex/(Age + Eth*Lrn), data = quine)fit_ib <- ib(fit_nb)## summary(fit_ib)## correct for overdispersion with H=100## Not run: fit_ib <- ib(fit_nb, control=list(H=100), extra_param = TRUE)summary(fit_ib)## End(Not run)## generalized linear mixed-effects regression## Not run: library(lme4) fit_glmm <- glmer(incidence / size ~ period + (1 | herd), weights = size, family = binomial, data = cbpp) fit_ib <- ib(fit_glmm) summary(fit_ib) ## correct for variances and correlation fit_ib <- ib(fit_glmm, extra_param = TRUE) summary(fit_ib)## End(Not run)## linear regressionfit_lm <- lm(disp ~ cyl + hp + wt, data = mtcars)fit_ib <- ib(fit_lm)summary(fit_ib)## correct for variance of residualsfit_ib <- ib(fit_lm, extra_param = TRUE)summary(fit_ib)## linear mixed-effects regression## Not run: library(lme4)fit_lmm <- lmer(Reaction ~ Days + (Days | Subject), data = sleepstudy, REML = FALSE)fit_ib <- ib(fit_lmm)summary(fit_ib)## correct for variances and correlationfit_ib <- ib(fit_lmm, extra_param = TRUE)summary(fit_ib)## End(Not run)## nonlinear regressionDNase1 <- subset(DNase, Run == 1)fit_nls <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal), data = DNase1)fit_ib <- ib(fit_nls)summary(fit_ib)## student regressionlibrary(VGAM)tdata <- data.frame(x = runif(nn <- 1000))tdata <- transform(tdata, y = rt(nn, df = exp(exp(0.5 - x))))fit_vglm <- vglm(y ~ x, studentt3, data = tdata)fit_ib <- ib(fit_vglm)summary(fit_ib)ib method fornegbin objectfromglm.nb function ofMASSpackage.
Description
ib method fornegbin objectfromglm.nb function ofMASSpackage.
Usage
## S4 method for signature 'negbin'ib(object, thetastart = NULL, control = list(...), extra_param = FALSE, ...)Arguments
object | an |
thetastart | an optional starting value for the iterative procedure.If |
control | a |
extra_param | if |
... | additional optional arguments (see 'Details'). |
Auxiliary for controlling IB
Description
Auxiliary function forib bias correction.
Usage
ibControl( tol = 1e-05, maxit = 25, verbose = FALSE, seed = 123L, H = 1L, constraint = TRUE, early_stop = FALSE, cens = FALSE, right = NULL, left = NULL, mis = FALSE, prop = NULL, out = FALSE, eps = NULL, G = NULL, func = function(x) rowMeans(x, na.rm = T), sim = NULL)Arguments
tol | positive convergence tolerance |
maxit |
|
verbose | if |
seed |
|
H |
|
constraint | if |
early_stop | if |
cens | if |
right |
|
left |
|
mis | if |
prop |
|
out | if |
eps |
|
G | a |
func | a |
sim | a user-defined function for simulating responses (see 'Details') |
Details
sim allows the user to provide its own function for generatingresponses. Currently it is only supported for generalized linear models withthe prototype 'fun(object, control, extra_param, ...)' (seeib).
Value
a list with components named as the arguments.
See Also
ib, the iterative procedure for bias correction.
Method for plotting an object in class union "Ib"
Description
Method for plotting an object in class union "Ib"
Usage
## S4 method for signature 'Ib,ANY'plot(x, y = NULL, ...)Arguments
x | an object of class union "Ib" |
y | not used |
... | further arguments to pass to |
See Also
Method for making predictions from an object in class union "Ib"
Description
Method for making predictions from an object in class union "Ib"
Usage
## S4 method for signature 'Ib'predict(object, ...)Arguments
object | an object of class union "Ib" |
... | further arguments to pass to |
See Also
Method for extracting residuals from an object in class union "Ib"
Description
Method for extracting residuals from an object in class union "Ib"
Usage
## S4 method for signature 'Ib'residuals(object, ...)Arguments
object | an object of class union "Ib" |
... | further arguments to pass to |
See Also
Method for printing object in class union "Ib"
Description
Method for printing object in class union "Ib"
Usage
## S4 method for signature 'Ib'show(object)Arguments
object | an object of class union "Ib" |
See Also
Summarizing a fitted model corrected by the ib procedure
Description
Method for printing asummary ofclass unionSummaryIb.
Usage
## S4 method for signature 'SummaryIb'show(object)Arguments
object | a summary object of member ofSummaryIb |
See Also
Generic for simulating from the object
Description
Method for simulating responses from an object.
Usage
simulation(object, control = list(...), ...)## S4 method for signature 'Ib'simulation(object, control = list(...), ...)Arguments
object | an object of class union "Ib" |
control | a control list |
... | further argument to pass |
Value
simulated responses.
Examples
## bootstrap poisson regressioncounts <- c(18,17,15,20,10,20,25,13,12)outcome <- gl(3,1,9)treatment <- gl(3,3)pois_fit <- glm(counts ~ outcome + treatment, family = poisson())## make 100 paramtric bootstrap replicatesboot_dist <- simulate(pois_fit, nsim = 100)Simulation for a beta regression
Description
simulation method for classIbBetareg, seeIb
Usage
## S4 method for signature 'betareg'simulation(object, control = list(...), extra = NULL, ...)Arguments
object | an object of class |
control | a |
extra |
|
... | further arguments |
Simulation for a Generalized Linear Model regression
Description
simulation method for classIbGlm, seeIb
Usage
## S4 method for signature 'glm'simulation(object, control = list(...), extra = NULL, ...)Arguments
object | an object of class |
control | a |
extra |
|
... | further arguments |
Simulation for linear mixed model regression
Description
simulation method for classIbGlmer, seeIb
Usage
## S4 method for signature 'glmerMod'simulation(object, control = list(...), ...)Arguments
object | an object of class |
control | a |
... | further arguments. |
Simulation for linear regression
Description
simulation method for classIbLm, seeIb
Usage
## S4 method for signature 'lm'simulation(object, control = list(...), std = NULL, ...)Arguments
object | an object of class |
control | a |
std |
|
... | further arguments |
Simulation for linear mixed model regression
Description
simulation method for classIb, seeIb
Usage
## S4 method for signature 'lmerMod'simulation(object, control = list(...), ...)Arguments
object | an object of class |
control | a |
... | further arguments. |
Simulation for a negative binomial regression
Description
simulation method for classIbNegbin, seeIb
Usage
## S4 method for signature 'negbin'simulation(object, control = list(...), extra = NULL, ...)Arguments
object | an object of class |
control | a |
extra |
|
... | further arguments |
Simulation for nonlinear regression
Description
simulation method for classIbNls, seeIb
Usage
## S4 method for signature 'nls'simulation(object, control = list(...), std = NULL, ...)Arguments
object | an object of class |
control | a |
std |
|
... | further arguments |
Simulation for vector generalized linear model regression
Description
simulation method for classIbVglm, seeIb
Usage
## S4 method for signature 'vglm'simulation(object, control = list(...), extra_param = NULL, ...)Arguments
object | an object of class |
control | a |
extra_param |
|
... | further arguments |
Summarizing a beta regression fit corrected bythe iterative bootstrap
Description
summary method for classIbBetareg
Usage
## S4 method for signature 'IbBetareg'summary(object, ...)Arguments
object | an object of classIbBetareg |
... | further arguments passed to |
See Also
Summarizing a Generalized Linear Model regression fit corrected bythe iterative bootstrap
Description
summary method for classIbGlm
Usage
## S4 method for signature 'IbGlm'summary(object, ...)Arguments
object | an object of classIbGlm |
... | further arguments passed to |
See Also
Summarizing a generalized linear mixed model regression fit corrected bythe iterative bootstrap
Description
summary method for classIbGlmer
Usage
## S4 method for signature 'IbGlmer'summary(object, ...)Arguments
object | an object of classIbGlmer |
... | further arguments passed to |
Summarizing a linear regression fit corrected bythe iterative bootstrap
Description
summary method for classIbLm
Usage
## S4 method for signature 'IbLm'summary(object, ...)Arguments
object | an object of classIbLm |
... | further arguments passed to |
See Also
Summarizing a linear mixed model regression fit corrected bythe iterative bootstrap
Description
summary method for classIbLmer
Usage
## S4 method for signature 'IbLmer'summary(object, ...)Arguments
object | an object of classIbLmer |
... | further arguments passed to |
Summarizing a negative binomial regression fits corrected bythe iterative bootstrap
Description
summary method for classIbNegbin
Usage
## S4 method for signature 'IbNegbin'summary(object, ...)Arguments
object | an object of classIbNegbin |
... | further arguments passed to |
See Also
Summarizing a nonlinear regression fit corrected bythe iterative bootstrap
Description
summary method for classIbNls
Usage
## S4 method for signature 'IbNls'summary(object, ...)Arguments
object | an object of classIbNls |
... | further arguments passed to |
Summarizing a vector generalized linear model regressionfit corrected by the iterative bootstrap
Description
summary method for classIbVglm
Usage
## S4 method for signature 'IbVglm'summary(object, ...)Arguments
object | an object of classIbVglm |
... | further arguments passed to |
Method for calculating covariance matrix from an object in class union "Ib"
Description
Method for calculating covariance matrix from an object in class union "Ib"
Usage
## S4 method for signature 'Ib'vcov(object, ...)Arguments
object | an object of class union "Ib" |
... | further arguments to pass to |