rwolf: Romano-Wolf multiple hypotheses adjusted p-values

View source: R/rwolf.R

rwolfR Documentation

Romano-Wolf multiple hypotheses adjusted p-values

Description

Function implements the Romano-Wolf multiple hypothesis correction procedure for objects of type 'fixest_multi' ('fixest_multi' are objects created by 'fixest::feols()' that use 'feols()' multiple-estimation interface). The null hypothesis is always imposed on the bootstrap dgp.

Usage

rwolf(
  models,
  param,
  B,
  R = NULL,
  r = 0,
  p_val_type = "two-tailed",
  weights_type = "rademacher",
  engine = "R",
  nthreads = 1,
  bootstrap_type = "fnw11",
  ...
)

Arguments

models

An object of type 'fixest_multi' or a list of objects of type 'fixest', estimated via ordinary least squares (OLS)

param

The regression parameter to be tested

B

The number of bootstrap iterations

R

Hypothesis Vector giving linear combinations of coefficients. Must be either NULL or a vector of the same length as 'param'. If NULL, a vector of ones of length param.

r

A numeric. Shifts the null hypothesis H0: 'param.' = r vs H1: 'param.' != r

p_val_type

Character vector of length 1. Type of hypothesis test By default "two-tailed". Other options include "equal-tailed" (for one-sided tests), ">" and "<" (for two-sided tests).

weights_type

character or function. The character string specifies the type of bootstrap to use: One of "rademacher", "mammen", "norm" and "webb". Alternatively, type can be a function(n) for drawing wild bootstrap factors. "rademacher" by default. For the Rademacher distribution, if the number of replications B exceeds the number of possible draw ombinations, 2^(#number of clusters), then 'boottest()' will use each possible combination once (enumeration).

engine

Should the wild cluster bootstrap run via ‘fwildclusterboot’s' R implementation or via ‘WildBootTests.jl'? ’R' by default. The other option is 'WildBootTests.jl'. Running the bootstrap through 'WildBootTests.jl' might significantly reduce the runtime of 'rwolf()' for complex problems (e.g. problems with more than 500 clusters).

nthreads

Integer. The number of threads to use when running the bootstrap.

bootstrap_type

Either "11", "13", "31", "33", or "fnw11". "fnw11" by default. See '?fwildclusterboot::boottest' for more details

...

additional function values passed to the bootstrap function.

Value

A data.frame containing the following columns:

model

Index of Models

Estimate

The estimated coefficient of 'param' in the respective model.

Std. Error

The estimated standard error of 'param' in the respective model.

t value

The t statistic of 'param' in the respective model.

Pr(>|t|)

The uncorrected pvalue for 'param' in the respective model.

RW Pr(>|t|)

The Romano-Wolf corrected pvalue of hypothesis test for 'param' in the respective model.

Setting Seeds and Random Number Generation

To guarantee reproducibility, please set a global random seeds via 'set.seed()'.

References

Clarke, Romano & Wolf (2019), STATA Journal. IZA working paper: https://ftp.iza.org/dp12845.pdf

Examples

 
library(fixest)
library(wildrwolf)

set.seed(12345)

N <- 1000
X1 <- rnorm(N)
Y1 <- 1 + 1 * X1 + rnorm(N)
Y2 <- 1 + 0.01 * X1 + rnorm(N)
Y3 <- 1 + 0.01 * X1 + rnorm(N)
Y4 <- 1 + 0.01 * X1 + rnorm(N)

B <- 999
# intra-cluster correlation of 0 for all clusters
cluster <- rep(1:50, N / 50)

data <- data.frame(Y1 = Y1, 
                   Y2 = Y2, 
                   Y3 = Y3, 
                   Y4 = Y4,
                   X1 = X1, 
                   cluster = cluster)

res <- feols(c(Y1, Y2, Y3) ~ X1, data = data, cluster = ~ cluster)
res_rwolf <- rwolf(models = res, param = "X1", B = B)
res_rwolf


wildrwolf documentation built on March 7, 2023, 5:37 p.m.