Bootstrapping for linear models
Bootstraping for linear models
boot_lm( object, f = NULL, R = 999, psim = 2, resid.type = c("resample", "normal", "wild"), ... )
object |
object of class |
f |
function to be applied (and bootstrapped), default coef |
R |
number of bootstrap samples, default 999 |
psim |
simulation level for |
resid.type |
either “resample”, “normal” or “wild”. |
... |
additional arguments to be passed to function |
The residuals can either be generated by resampling with replacement (default), from a normal distribution (parameteric) or by changing their signs (wild). This last one is called “wild bootstrap”.
require(car) data(barley, package = "nlraa") ## Fit a linear model (quadratic) fit.lm <- lm(yield ~ NF + I(NF^2), data = barley) ## Bootstrap coefficients by default fit.lm.bt <- boot_lm(fit.lm) ## Compute confidence intervals confint(fit.lm.bt, type = "perc") ## Visualize hist(fit.lm.bt, 1, ci = "perc", main = "Intercept") hist(fit.lm.bt, 2, ci = "perc", main = "NF term") hist(fit.lm.bt, 3, ci = "perc", main = "I(NF^2) term")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.