bh_adj: Apply Benjamini-Hochberg adjustment to model summary object

View source: R/bh_adj.R

bh_adjR Documentation

Apply Benjamini-Hochberg adjustment to model summary object

Description

This function takes a lm or glm model object and returns a tibble with the Benjamini-Hochberg adjustment for false discovery rate applied. New columns include p-value rank ('rank'), adjusted alpha ('adj_a'), adjusted p-values ('p_bh'), star indicators for significance level ('stars_bh'), and a logical indicator of significance with the Benjamini-Hochberg adjustment applied ('sig_bh').

Usage

bh_adj(x, fdr = 0.05, coef_vec = NULL, p_name = NULL)

Arguments

x

Model summary object. For example, summary(model).

fdr

False discovery rate. 0.05 by default.

coef_vec

Optional. A vector of coefficient names as strings. p-values associated with the coefficients in this vector will be included in the adjustment and all other coefficients will be excluded.

p_name

Optional. The name of the p-value column in the summary object that results from running summary(x), where x is your model. By default, the function will look for "Pr(>|t|)" and "Pr(>|z|)". If neither of these is found and the correct 'p_name' is not specified, an error will result.

Value

A tibble

Examples

m1 <- lm(mpg ~ cyl + hp + wt, data = mtcars)
bh_adj(m1)

Faunalytics/faunalytics documentation built on Nov. 2, 2024, 12:05 a.m.