library(boot.pval)
<- lm(mpg ~ hp + vs, data = mtcars)
model
boot_summary(model)
A new version of the boot.pval
package is now available on CRAN. It can be used to compute bootstrap p-values and confidence intervals for regression coefficients with a single line of code. It works for linear models, GLMs, Cox regression, mixed models, and more.
News in version 0.6
- Now works also when there’s missing data (previously, an error inherited from
car::Boot
would appear if the data frame contained missing values). - Improved presentation of low p-values.
- Added support for BCa intervals.
- A vignette has been added.
A short example
After fitting a regression model, confidence intervals for \(\beta_i\) and bootstrap p-values for the hypotheses \(H_0: \beta_i=0\) can be obtained with a single line of code:
Estimate Lower.bound Upper.bound p.value
(Intercept) 26.96300111 21.06466359 32.43154604 <0.001
hp -0.05453412 -0.08042437 -0.02384551 <0.001
vs 2.57622314 -1.09704998 6.61474042 0.176
And publication-ready tables in two lines:
boot_summary(model) |>
summary_to_gt()
Estimate | 95 % CI | p-value | |
---|---|---|---|
(Intercept) | 26.963 | (21.065, 32.432) | <0.001 |
hp | −0.055 | (−0.080, −0.024) | <0.001 |
vs | 2.576 | (−1.097, 6.615) | 0.176 |