This function performs hypothesis testing by controlling the False Discovery Rate (FDR) based on the
local false discovery rate (lfdr) stored in the fash
object.
fdr_control(fash_obj, alpha = 0.05, plot = FALSE)
A list containing:
- fdr_results
: A data frame with columns:
- index
: The original dataset index.
- FDR
: The false discovery rate for each dataset.
# Example usage
set.seed(1)
data_list <- list(
data.frame(y = rnorm(n = 5, sd = 0.5), x = 1:5, offset = 0),
data.frame(y = rnorm(n = 5, sd = 0.8), x = 1:5, offset = 0),
data.frame(y = rnorm(n = 5, sd = 0.6), x = 1:5, offset = 0),
data.frame(y = rnorm(n = 5, sd = 0.7), x = 1:5, offset = 0)
)
S <- list(rep(0.5, 5), rep(0.8, 5), rep(0.6, 5), rep(0.7, 5))
grid <- seq(0, 2, length.out = 10)
fash_obj <- fash(data_list = data_list, Y = "y", smooth_var = "x", offset = "offset", S = S, grid = grid, likelihood = "gaussian", verbose = TRUE)
#> Starting data setup...
#> Completed data setup in 0.00 seconds.
#> Starting likelihood computation...
#>
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
#> Completed likelihood computation in 0.19 seconds.
#> Starting empirical Bayes estimation...
#> Completed empirical Bayes estimation in 0.00 seconds.
#> fash object created successfully.
fdr_control(fash_obj, alpha = 0.05, plot = TRUE)
#> 0 datasets are significant at alpha level 0.05. Total datasets tested: 4.
#> $fdr_results
#> index FDR
#> 1 3 0.2886996
#> 2 2 0.4243116
#> 3 4 0.5039420
#> 4 1 0.5562812
#>