Generates adjusted p-values using the algorithm described in Westfall and Young (1993).

boot_stepdown(full_formulas, null_formulas, data, coef_list,
  weights = NULL, cluster = NULL, nboots = 10000,
  boot_type = c("wild", "pairs"), parallel = TRUE, pb = TRUE)

Arguments

full_formulas

A list of objects of class formula, specifying the full (unrestricted) models.

null_formulas

A list of objects of class formula, specifying the null (restricted) models.

data

A data frame containing the variables in the models.

coef_list

A character vector specifying the variable for each model for which the p-value is to be adjusted.

weights

An optional list of weights to be used in the fitting process. Each element of the list should be a numeric vector with length equals to the number of rows in data. If NULL, each observation is given a weight of 1. Weights can be used to specify subgroups, by giving units outside the subgroup of interest a weight of 0.

cluster

An optional character string indicating the column in the data frame that records the cluster to which an observation belongs (for computing standard errors that account for clustering).

nboots

The number of bootstrap replicates, a single positive integer.

boot_type

A character string indicating the type of resampling required. Possible values are wild or pairs.

parallel

logical, indicating if parallel operation is to be used. If TRUE, a parallel backend should be registered prior to running boot_stepdown. See the documentation for foreach in the foreach package for more details.

pb

logical. Should a progress bar be displayed if parallel is FALSE? Ignored if parallel is TRUE.

Value

A data frame reporting unadjusted and adjusted p-values for each hypothesis provided in full_formulas and null_formulas.

References

Westfall, Peter H., and S. Stanley Young. 1993. Resampling- Based Multiple Testing: Examples and Methods for P-Value Adjustment. John Wiley & Sons, New York.

Examples

# Replicate Casey et al 2012, Table II Column 3 F <- lapply(sprintf("zscore_%d ~ 0 + t + tothhs + road + ward", 1:12), as.formula) pvals <- boot_stepdown(full_formulas = F, null_formulas = lapply(F, update, . ~ . - t), data = gobifo, coef_list = "t", nboots = 100, # small nboots for demonstration only parallel = FALSE, boot_type = "pairs")
#> ================================================================================
dplyr::mutate_if(pvals, is.numeric, round, 3)
#> Hypothesis Variable bs_pvalues_unadjusted bs_pvalues_adjusted #> 1 Hypothesis 1 t 0.010 0.010 #> 2 Hypothesis 2 t 0.010 0.010 #> 3 Hypothesis 3 t 0.010 0.010 #> 4 Hypothesis 4 t 0.624 0.950 #> 5 Hypothesis 5 t 0.950 0.970 #> 6 Hypothesis 6 t 0.188 0.703 #> 7 Hypothesis 7 t 0.366 0.931 #> 8 Hypothesis 8 t 0.396 0.931 #> 9 Hypothesis 9 t 0.287 0.931 #> 10 Hypothesis 10 t 0.040 0.317 #> 11 Hypothesis 11 t 0.891 0.970 #> 12 Hypothesis 12 t 0.317 0.931