Title: | Simple False Discovery Rate Calculation |
---|---|
Description: | Using the adjustment method from Benjamini & Hochberg (1995) <doi:10.1111/j.2517-6161.1995.tb02031.x>, this package determines which variables are significant under repeated testing with a given dataframe of p values and an user defined "q" threshold. It then returns the original dataframe along with a significance column where an asterisk denotes a significant p value after FDR calculation, and NA denotes all other p values. This package uses the Benjamini & Hochberg method specifically as described in Lee, S., & Lee, D. K. (2018) <doi:10.4097/kja.d.18.00242>. |
Authors: | Stephen C Wisser |
Maintainer: | Stephen Wisser <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.1 |
Built: | 2024-12-01 08:04:20 UTC |
Source: | CRAN |
Using the Benjamini & Hochberg adjustment method, determine which variables are significant under repeated testing with a given dataframe of p values and an user defined "q" threshold.
simFDR(df, q = 0.05, sig_only = TRUE)
simFDR(df, q = 0.05, sig_only = TRUE)
df |
dataframe with variable names in column 1, and p values in column 2. For dataframes with more than these 2 columns, the additional columns will be ignored. Example: df<- data.frame("variable"= c("a","b","c","d","e","f","g","h","i","j","k"),"p_value" = c(0.04,0.03,0.04,0.02,0.03,0.02,0.02,0.01,0.04,0.1,0.02)) |
q |
user defined FDR threshold. Defaults to 0.05. |
sig_only |
logical value indicating whether to return just the variables that are significant, or all input variables. If TRUE, only significant variables are returned. If FALSE, all variables are returned with the significant variables at the top. Defaults to TRUE. |
Returns the original dataframe with a significance column where an asterisk denotes a significant p value after FDR calculation, and NA denotes all other p values.
Stephen C Wisser
Lee, S., & Lee, D. K. (2018). What is the proper way to apply the multiple comparison test?. Korean journal of anesthesiology, 71(5), 353.
Benjamini, Y., & Hochberg, Y. (1995). Controlling the false discovery rate: a practical and powerful approach to multiple testing. Journal of the Royal statistical society: series B (Methodological), 57(1), 289-300.
df <- data.frame("variable"= c("a","b","c","d","e"),"p_value" = c(0.04,0.03,0.04,0.02,0.03)) # defaults to q = 0.05 and shows only significant p values FDR_values <- simFDR(df) # q = 0.1 and shows only significant p values FDR_values <- simFDR(df, q = 0.1) # q = 0.05 and shows all p values, with significant p values at the top FDR_values <- simFDR(df, sig_only = FALSE)
df <- data.frame("variable"= c("a","b","c","d","e"),"p_value" = c(0.04,0.03,0.04,0.02,0.03)) # defaults to q = 0.05 and shows only significant p values FDR_values <- simFDR(df) # q = 0.1 and shows only significant p values FDR_values <- simFDR(df, q = 0.1) # q = 0.05 and shows all p values, with significant p values at the top FDR_values <- simFDR(df, sig_only = FALSE)