Package 'wildwyoung'

Title: Westfall-Young adjusted p-values for objects linear models via a wild bootstrap
Description: Implements Westfall-Young corrected p-values for objects of type 'fixest' and 'fixest_multi' via a wild (cluster) bootstrap.
Authors: Alexander Fischer
Maintainer: Alexander Fischer <[email protected]>
License: MIT + file LICENSE
Version: 0.1.4
Built: 2025-01-20 04:57:22 UTC
Source: https://github.com/s3alfisc/wildwyoung

Help Index


Summary method for objects of type wyoung

Description

Summary method for objects of type wyoung

Usage

## S3 method for class 'wyoung'
summary(object, digits, ...)

Arguments

object

An object of type wyoung

digits

Rounding of digits

...

misc. function arguments


Westfall-Young multiple hypotheses adjusted p-values

Description

Function implements the Westfall-Young multiple hypthesis correction procedure for objects of type fixest_multi (fixest_multi are objects created by fixest::feols() that use feols() multiple-estimation interface).

Usage

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

Arguments

models

An object of type fixest_multi or a list of objects of type fixest

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", ">" and "<".

weights_type

character or function. The character string specifies the type of boostrap 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).

seed

Integer. Sets the random seed. NULL by default.

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'.

nthreads

Integer. The number of threads to use.

bootstrap_type

Either "11", "13", "31", "33", or "fnw11".

...

additional function values passed to the bootstrap function.

Value

An object of type wyoung

References

Westfall, Peter H., and S. Stanley Young. Resampling-based multiple testing: Examples and methods for p-value adjustment. Vol. 279. John Wiley & Sons, 1993.

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

Examples

library(fixest)
library(wildwyoung)

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_wyoung <- wyoung(models = res, param = "X1", B = B)
summary(res_wyoung)