Learn R Programming

fwildclusterboot (version 0.3.4)

boottest: Fast wild cluster bootstrap inference

Description

boottest is a S3 method that allows for fast wild cluster bootstrap inference for objects of class lm, fixest and felm by implementing the fast wild bootstrap algorithm developed in Roodman et al., 2019.

Usage

boottest(object, ...)

Arguments

object

An object of type lm, fixest of felm

...

other arguments

Value

An object of class boottest

p_val

The bootstrap p-value.

t_stat

The bootstrap t-statistic.

conf_int

The bootstrap confidence interval.

param

The tested parameter.

N

Sample size. Might differ from the regression sample size if the cluster variables contain NA values.

B

Number of Bootstrap Iterations.

clustid

Names of the cluster Variables.

N_G

Dimension of the cluster variables as used in boottest.

sign_level

Significance level used in boottest.

type

Distribution of the bootstrap weights.

p_test_vals

All p-values calculated while calculating the confidence interval.

test_vals

All t-statistics calculated while calculating the confidence interval.

regression

The regression object used in boottest.

call

Function call of boottest.

Confidence Intervals

boottest computes confidence intervals by inverting p-values. In practice, the following procedure is used:

  • Based on an initial guess for starting values, calculate p-values for 26 equal spaced points between the starting values.

  • Out of the 26 calculated p-values, find the two pairs of values x for which the corresponding p-values px cross the significance level sign_level.

  • Feed the two pairs of x into an numerical root finding procedure and solve for the root. boottest currently relies on stats::uniroot and sets an absolute tolerance of 1e-06 and stops the procedure after 10 iterations.

Standard Errors

boottest does not calculate standard errors.

References

Roodman et al., 2019, "Fast and wild: Bootstrap inference in STATA using boottest", The STATA Journal. (https://journals.sagepub.com/doi/full/10.1177/1536867X19830877)

Examples

Run this code
# NOT RUN {
library(fwildclusterboot)
data(voters)
lm_fit <-lm(proposition_vote ~ treatment + ideology1 + log_income + Q1_immigration,
         data = voters)
boot1 <- boottest(lm_fit, 
                  B = 9999, 
                  param = "treatment",
                   clustid = "group_id1")
boot2 <- boottest(lm_fit,
                  B = 9999,
                  param = "treatment",
                 clustid = c("group_id1", "group_id2"))
boot3 <- boottest(lm_fit,
                  B = 9999,
                  param = "treatment",
                  clustid = c("group_id1", "group_id2"),
                  sign_level = 0.2,
                  seed = 8,
                  beta0 = 2)
summary(boot1)
plot(boot1)
# }

Run the code above in your browser using DataLab