### Install onlineFDR from GitHub Source: https://dsrobertson.github.io/onlineFDR/index.html Installs the latest development snapshot of the onlineFDR package directly from its GitHub repository. Requires the devtools package. ```r # install.packages("devtools") # If devtools not installed devtools::install_github("dsrobertson/onlineFDR") ``` -------------------------------- ### Initialize LOND with Sample Data Source: https://dsrobertson.github.io/onlineFDR/articles/onlineFDR.html Demonstrates the initial setup for the LOND procedure with a small sample dataset. Ensure the 'id', 'date', and 'pval' columns are correctly formatted. ```R sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705'), date = as.Date(c(rep("2014-12-01",3))), pval = c(2.90e-14, 0.06743, 0.01514)) set.seed(1) LOND_results <- LOND(sample.df) ``` -------------------------------- ### Alpha Investing with Randomization Source: https://dsrobertson.github.io/onlineFDR/reference/Alpha_investing.html This example demonstrates using the Alpha_investing function with randomization enabled (default behavior). A fixed seed is set for reproducibility. ```R set.seed(1); Alpha_investing(sample.df) #> pval alphai R #> 1 2.9000e-08 0.010818925 1 #> 2 6.7430e-02 0.021406257 0 #> 3 1.5140e-02 0.007164201 0 #> 4 8.1740e-02 0.003757589 0 #> 5 1.7100e-03 0.002374706 1 #> 6 2.7201e-01 0.023680499 0 #> 7 3.6000e-05 0.008803369 1 #> 8 7.9149e-01 0.029838354 0 #> 9 7.5900e-08 0.012084065 1 #> 10 2.8295e-01 0.032981505 0 #> 11 6.9274e-01 0.014137539 0 #> 12 7.2342e-01 0.008529625 0 #> 13 3.0443e-01 0.005905508 0 #> 14 5.4757e-01 0.004412045 0 #> 15 1.3600e-03 0.003461425 1 ``` -------------------------------- ### Example Dataframe Creation Source: https://dsrobertson.github.io/onlineFDR/reference/online_fallback.html Creates a sample dataframe with p-values, identifiers, and dates for testing the online_fallback function. ```R sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) ) ``` -------------------------------- ### Run LOND with Expanded Sample Data Source: https://dsrobertson.github.io/onlineFDR/articles/onlineFDR.html Shows how to run the LOND procedure with a larger, more comprehensive sample dataset. This example includes more data points and varied dates. ```R sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep("2014-12-01",3), rep("2015-09-21",5), rep("2016-05-19",2), "2016-11-12", rep("2017-03-27",4))), pval = c(2.90e-14, 0.06743, 0.01514, 0.08174, 0.00171, 3.61e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.000487, 0.72342, 0.54757)) set.seed(1) LOND_results <- LOND(sample.df) ``` -------------------------------- ### Install onlineFDR from Bioconductor (release) Source: https://dsrobertson.github.io/onlineFDR/index.html Installs the stable release version of the onlineFDR package from Bioconductor. Ensure BiocManager is installed first. ```r if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("onlineFDR") ``` -------------------------------- ### Running supLORD with Simulated Data Source: https://dsrobertson.github.io/onlineFDR/reference/supLORD.html This example demonstrates how to use the supLORD function with simulated p-values. It shows the typical workflow from generating data to applying the function and inspecting the results. ```R set.seed(1) N <- 1000 B <- rbinom(N, 1, 0.5) Z <- rnorm(N, mean = 3*B) pval <- pnorm(-Z) out <- supLORD(pval, eps=0.15, r=30, eta=0.05, rho=30, random=FALSE) head(out) #> d alphai R #> 1 4.691912e-01 0.0019301522 0 #> 2 6.167166e-01 0.0004197471 0 #> 3 3.462711e-02 0.0003575072 0 #> 4 1.300690e-03 0.0002973164 0 #> 5 1.606961e-01 0.0002520627 0 #> 6 2.174486e-06 0.0002180533 1 sum(out$R) #> [1] 390 ``` -------------------------------- ### BatchBH Example Usage Source: https://dsrobertson.github.io/onlineFDR/reference/BatchBH.html Demonstrates how to use the BatchBH function with a sample dataframe containing identifiers, p-values, and batch numbers. It shows the output with discoveries indicated. ```R sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), batch = c(rep(1,5), rep(2,6), rep(3,4))) BatchBH(sample.df) ``` -------------------------------- ### View onlineFDR Vignette Source: https://dsrobertson.github.io/onlineFDR/index.html Opens the vignette for the installed version of the onlineFDR package in R. Vignettes provide detailed examples and explanations. ```r browseVignettes("onlineFDR") ``` -------------------------------- ### StoreyBH Example Usage Source: https://dsrobertson.github.io/onlineFDR/reference/StoreyBH.html Demonstrates how to use the StoreyBH function with a sample vector of p-values to control FDR. ```R pvals <- c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757) StoreyBH(pvals) #> pval R #> 1 2.9000e-08 1 #> 2 6.7430e-02 0 #> 3 1.5140e-02 1 #> 4 8.1740e-02 0 #> 5 1.7100e-03 1 #> 6 3.6000e-05 1 #> 7 7.9149e-01 0 #> 8 2.7201e-01 0 #> 9 2.8295e-01 0 #> 10 7.5900e-08 1 #> 11 6.9274e-01 0 #> 12 3.0443e-01 0 #> 13 1.3600e-03 1 #> 14 7.2342e-01 0 #> 15 5.4757e-01 0 ``` -------------------------------- ### Install onlineFDR from Bioconductor (devel) Source: https://dsrobertson.github.io/onlineFDR/index.html Installs the development version of the onlineFDR package from Bioconductor. This may include newer features but could be less stable. ```r if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install(version = "devel") BiocManager::install("onlineFDR") ``` -------------------------------- ### R: Alpha Spending with Custom Alpha Level Source: https://dsrobertson.github.io/onlineFDR/reference/Alpha_spending.html This example demonstrates how to specify a custom overall alpha level (e.g., 0.1) for the Alpha_spending function. This affects the calculation of adjusted p-values and the significance threshold. ```r set.seed(1); Alpha_spending(sample.df, alpha=0.1) #> id date pval alphai R #> 1 A15432 2014-12-01 2.9000e-17 0.0053516771 1 #> 2 B90969 2014-12-01 6.7430e-02 0.0011638206 0 #> 3 C18705 2014-12-01 1.5140e-02 0.0009912499 0 #> 4 B49731 2015-09-21 8.1740e-02 0.0008243606 0 #> 5 E99902 2015-09-21 1.7100e-03 0.0006988870 0 #> 6 D46627 2015-09-21 2.7201e-01 0.0006045900 0 #> 7 C38292 2015-09-21 3.6000e-05 0.0005319444 1 #> 8 A30619 2015-09-21 7.9149e-01 0.0004745225 0 #> 9 A41418 2016-05-19 7.5900e-08 0.0004280949 1 #> 10 E29198 2016-05-19 2.8295e-01 0.0003898252 0 #> 11 D51456 2016-11-12 6.9274e-01 0.0003577593 0 #> 12 A63155 2017-03-27 7.2342e-01 0.0003305137 0 #> 13 C88669 2017-03-27 3.0443e-01 0.0003070841 0 #> 14 B66033 2017-03-27 5.4757e-01 0.0002867254 0 #> 15 E03673 2017-03-27 1.3600e-03 0.0002688736 0 ``` -------------------------------- ### R: Alpha Spending with Randomization Disabled Source: https://dsrobertson.github.io/onlineFDR/reference/Alpha_spending.html This example shows how to use Alpha_spending without randomization by setting the 'random' argument to FALSE. This ensures deterministic results for the same input data. ```r Alpha_spending(sample.df, random=FALSE) #> id date pval alphai R #> 1 A15432 2014-12-01 2.9000e-17 0.0026758385 1 #> 2 B90969 2014-12-01 6.7430e-02 0.0005819103 0 #> 3 C18705 2014-12-01 1.5140e-02 0.0004956249 0 #> 4 B49731 2015-09-21 8.1740e-02 0.0004121803 0 #> 5 E99902 2015-09-21 1.7100e-03 0.0003494435 0 #> 6 C38292 2015-09-21 3.6000e-05 0.0003022950 1 #> 7 A30619 2015-09-21 7.9149e-01 0.0002659722 0 #> 8 D46627 2015-09-21 2.7201e-01 0.0002372613 0 #> 9 E29198 2016-05-19 2.8295e-01 0.0002140474 0 #> 10 A41418 2016-05-19 7.5900e-08 0.0001949126 1 #> 11 D51456 2016-11-12 6.9274e-01 0.0001788796 0 #> 12 C88669 2017-03-27 3.0443e-01 0.0001652568 0 #> 13 E03673 2017-03-27 1.3600e-03 0.0001535420 0 #> 14 A63155 2017-03-27 7.2342e-01 0.0001433627 0 #> 15 B66033 2017-03-27 5.4757e-01 0.0001344368 0 ``` -------------------------------- ### Example Usage of BatchPRDS Source: https://dsrobertson.github.io/onlineFDR/reference/BatchPRDS.html Demonstrates how to use the BatchPRDS function with a sample dataframe containing identifiers, p-values, and batch numbers. The output includes the original data and an indicator of discoveries. ```r sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), batch = c(rep(1,5), rep(2,6), rep(3,4))) BatchPRDS(sample.df) ``` -------------------------------- ### BatchStBH Example Usage Source: https://dsrobertson.github.io/onlineFDR/reference/BatchStBH.html Demonstrates how to use the BatchStBH function with a sample dataframe containing identifiers, p-values, and batch numbers. The output includes the original data with an added 'R' column indicating discoveries and adjusted significance thresholds. ```R sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), batch = c(rep(1,5), rep(2,6), rep(3,4))) BatchStBH(sample.df) ``` -------------------------------- ### Create Sample Dataframe Source: https://dsrobertson.github.io/onlineFDR/articles/onlineFDR.html Initializes a toy dataset with identifier, date, and p-value columns. Ensure the date is in 'YYYY-MM-DD' format. ```r sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep("2014-12-01",3), rep("2015-09-21",5), rep("2016-05-19",2), "2016-11-12", rep("2017-03-27",4))), pval = c(2.90e-14, 0.00143, 0.06514, 0.00174, 0.00171, 3.61e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.000487, 0.72342, 0.54757)) ) ``` -------------------------------- ### LONDstar with Async Version Source: https://dsrobertson.github.io/onlineFDR/reference/LONDstar.html Demonstrates creating a sample data frame and applying the LONDstar function with the 'async' version. This is useful for standard FDR control. ```R sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), decision.times = seq_len(15) + 1) LONDstar(sample.df, version='async') ``` -------------------------------- ### Alpha Investing with Default Parameters Source: https://dsrobertson.github.io/onlineFDR/reference/Alpha_investing.html This snippet shows how to use the Alpha_investing function with a sample dataframe and default parameters (random=FALSE). It displays the calculated p-values, alpha values, and R indicators. ```R sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) Alpha_investing(sample.df, random=FALSE) #> pval alphai R #> 1 2.9000e-08 0.010818925 1 #> 2 6.7430e-02 0.021406257 0 #> 3 1.5140e-02 0.007164201 0 #> 4 8.1740e-02 0.003757589 0 #> 5 1.7100e-03 0.002374706 1 #> 6 3.6000e-05 0.023680499 1 #> 7 7.9149e-01 0.044095287 0 #> 8 2.7201e-01 0.015842430 0 #> 9 2.8295e-01 0.008711190 0 #> 10 7.5900e-08 0.005700295 1 #> 11 6.9274e-01 0.026865786 0 #> 12 3.0443e-01 0.011205456 0 #> 13 1.3600e-03 0.006863124 1 #> 14 7.2342e-01 0.027979664 0 #> 15 5.4757e-01 0.011945806 0 ``` -------------------------------- ### Alpha Investing with Custom Alpha and W0 Source: https://dsrobertson.github.io/onlineFDR/reference/Alpha_investing.html This snippet demonstrates how to use the Alpha_investing function with custom values for the 'alpha' and 'w0' parameters. A fixed seed is used for reproducible results. ```R set.seed(1); Alpha_investing(sample.df, alpha=0.1, w0=0.025) #> pval alphai R #> 1 2.9000e-08 0.010818925 1 #> 2 6.7430e-02 0.041915265 0 #> 3 1.5140e-02 0.014226480 0 #> 4 8.1740e-02 0.007487045 0 #> 5 1.7100e-03 0.004738159 1 #> 6 2.7201e-01 0.046265410 0 #> 7 3.6000e-05 0.017453092 1 #> 8 7.9149e-01 0.057947646 0 #> 9 7.5900e-08 0.023879569 1 #> 10 2.8295e-01 0.063856912 0 #> 11 6.9274e-01 0.027880910 0 #> 12 7.2342e-01 0.016914972 0 #> 13 3.0443e-01 0.011741675 0 #> 14 5.4757e-01 0.008785330 0 #> 15 1.3600e-03 0.006898971 1 ``` -------------------------------- ### SAFFRONstar with 'async' version Source: https://dsrobertson.github.io/onlineFDR/reference/SAFFRONstar.html This snippet demonstrates how to use SAFFRONstar with the 'async' version. It requires a data frame with 'id', 'pval', and 'decision.times' columns. ```R sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), decision.times = seq_len(15) + 1) SAFFRONstar(sample.df, version='async') #> pval alphai R #> 1 2.9000e-08 0.005468627 1 #> 2 6.7430e-02 0.001803974 0 #> 3 1.5140e-02 0.007272601 0 #> 4 8.1740e-02 0.003607948 0 #> 5 1.7100e-03 0.003607948 1 #> 6 3.6000e-05 0.003607948 1 #> 7 7.9149e-01 0.014545202 0 #> 8 2.7201e-01 0.018153151 0 #> 9 2.8295e-01 0.007379710 0 #> 10 7.5900e-08 0.007379710 1 #> 11 6.9274e-01 0.007379710 0 #> 12 3.0443e-01 0.018316965 0 #> 13 1.3600e-03 0.007874188 1 #> 14 7.2342e-01 0.007874188 0 #> 15 5.4757e-01 0.018811442 0 ``` -------------------------------- ### SAFFRON with Custom Alpha and W0 Source: https://dsrobertson.github.io/onlineFDR/reference/SAFFRON.html This snippet demonstrates using the SAFFRON function with custom alpha and w0 parameters. 'set.seed(1)' is used for reproducibility. ```R set.seed(1); SAFFRON(sample.df, alpha=0.1, w0=0.025) #> pval alphai R id #> 1 2.9000e-08 0.005468627 1 A15432 #> 2 6.7430e-02 0.021874508 0 B90969 #> 3 1.5140e-02 0.021874508 1 C18705 #> 4 8.1740e-02 0.043749017 0 B49731 #> 5 1.7100e-03 0.043749017 1 E99902 #> 6 2.7201e-01 0.065623525 0 D46627 #> 7 3.6000e-05 0.065623525 1 C38292 #> 8 7.9149e-01 0.087498033 0 A30619 #> 9 7.5900e-08 0.028863587 1 A41418 #> 10 2.8295e-01 0.050738095 0 E29198 #> 11 6.9274e-01 0.050738095 0 D51456 #> 12 7.2342e-01 0.022302945 0 A63155 #> 13 3.0443e-01 0.013293195 0 C88669 #> 14 5.4757e-01 0.013293195 0 B66033 #> 15 1.3600e-03 0.009042997 1 E03673 ``` -------------------------------- ### Run LOND Algorithm and View Results Source: https://dsrobertson.github.io/onlineFDR/articles/onlineFDR.html Applies the LOND algorithm to the sample data and displays the results, including p-values, adjusted significance thresholds (alphai), and an indicator of discovery (R). Setting a seed ensures reproducibility. ```r library(onlineFDR) set.seed(1) LOND_results <- LOND(sample.df) LOND_results ``` -------------------------------- ### Set FDR Bound for LOND Source: https://dsrobertson.github.io/onlineFDR/articles/onlineFDR.html Illustrates how to set a priori bounds for the LOND procedure using the setBound function. This is useful when the number of expected hypotheses is known. Ensure alpha matches the algorithm's alpha. ```R sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep("2014-12-01",3), rep("2015-09-21",5), rep("2016-05-19",2), "2016-11-12", rep("2017-03-27",4))), pval = c(2.90e-14, 0.06743, 0.01514, 0.08174, 0.00171, 3.61e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.000487, 0.72342, 0.54757)) # Assuming a bound of 20 hypotheses bound <- setBound("LOND", alpha = 0.04, 20) set.seed(1) LOND_results <- LOND(sample.df, alpha = 0.04, betai = bound) ``` -------------------------------- ### Run Online Fallback with Dataframe (random=FALSE) Source: https://dsrobertson.github.io/onlineFDR/reference/online_fallback.html Applies the online_fallback procedure to a sample dataframe with p-values, ensuring a fixed order by setting random=FALSE. ```R online_fallback(sample.df, random=FALSE) #> pval alphai R #> 1 2.9000e-08 0.0026758385 1 #> 2 6.7430e-02 0.0032577488 0 #> 3 1.5140e-02 0.0004956249 0 #> 4 8.1740e-02 0.0004121803 0 #> 5 1.7100e-03 0.0003494435 0 #> 6 3.6000e-05 0.0003022950 1 #> 7 7.9149e-01 0.0005682672 0 #> 8 2.7201e-01 0.0002372613 0 #> 9 2.8295e-01 0.0002140474 0 #> 10 7.5900e-08 0.0001949126 1 #> 11 6.9274e-01 0.0003737922 0 #> 12 3.0443e-01 0.0001652568 0 #> 13 1.3600e-03 0.0001535420 0 #> 14 7.2342e-01 0.0001433627 0 #> 15 5.4757e-01 0.0001344368 0 ``` -------------------------------- ### ADDIS-spending with Locally Dependent P-values Source: https://dsrobertson.github.io/onlineFDR/reference/ADDIS_spending.html Demonstrates the usage of ADDIS_spending with a sample dataframe for locally dependent p-values by setting `dep = TRUE`. The output structure is similar to the independent case, showing p-values, adjusted testing levels, and discoveries. ```R ADDIS_spending(sample.df, dep = TRUE) #Locally dependent #> pval alphai R #> 1 2.9000e-08 0.0054686271 1 #> 2 6.7430e-02 0.0018039742 0 #> 3 1.5140e-02 0.0018039742 0 #> 4 8.1740e-02 0.0018039742 0 #> 5 1.7100e-03 0.0018039742 1 #> 6 3.6000e-05 0.0018039742 1 #> 7 7.9149e-01 0.0018039742 0 #> 8 2.7201e-01 0.0018039742 0 #> 9 2.8295e-01 0.0009429405 0 #> 10 7.5900e-08 0.0005950895 1 #> 11 6.9274e-01 0.0005950895 0 #> 12 3.0443e-01 0.0005950895 0 #> 13 1.3600e-03 0.0004164149 0 #> 14 7.2342e-01 0.0004164149 0 #> 15 5.4757e-01 0.0004164149 0 ``` -------------------------------- ### ADDIS-spending with Independent P-values Source: https://dsrobertson.github.io/onlineFDR/reference/ADDIS_spending.html Demonstrates the usage of ADDIS_spending with a sample dataframe for independent p-values. The output includes p-values, adjusted testing levels (alphai), and an indicator of discoveries (R). ```R sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), lags = rep(1,15)) ADDIS_spending(sample.df) #independent #> pval alphai R #> 1 2.9000e-08 0.0054686271 1 #> 2 6.7430e-02 0.0054686271 0 #> 3 1.5140e-02 0.0054686271 0 #> 4 8.1740e-02 0.0054686271 0 #> 5 1.7100e-03 0.0054686271 1 #> 6 3.6000e-05 0.0054686271 1 #> 7 7.9149e-01 0.0054686271 0 #> 8 2.7201e-01 0.0054686271 0 #> 9 2.8295e-01 0.0018039742 0 #> 10 7.5900e-08 0.0009429405 1 #> 11 6.9274e-01 0.0009429405 0 #> 12 3.0443e-01 0.0009429405 0 #> 13 1.3600e-03 0.0005950895 0 #> 14 7.2342e-01 0.0005950895 0 #> 15 5.4757e-01 0.0005950895 0 ``` -------------------------------- ### Compare Adjusted Significance Thresholds for Different LORD Versions Source: https://dsrobertson.github.io/onlineFDR/articles/advanced-usage.html This snippet demonstrates how to compare adjusted significance thresholds (alphai) across different versions of the LORD method ('++', 3, 'discard', 'dep'). It's useful for evaluating the impact of version choice on FDR control. ```r set.seed(1); results.LORD.plus <- LORD(sample.df) set.seed(1); results.LORD3 <- LORD(sample.df, version=3) set.seed(1); results.LORD.discard <- LORD(sample.df, version='discard') set.seed(1); results.LORD.dep <- LORD(sample.df, version='dep') # compare adjusted significance thresholds cbind(LORD.plus = results.LORD.plus$alphai, LORD3 = results.LORD3$alphai, LORD.discard = results.LORD.discard$alphai, LORD.dep = results.LORD.dep$alphai) #> LORD.plus LORD3 LORD.discard LORD.dep #> [1,] 0.0002675839 0.0002675839 0.0002675839 2.091542e-03 #> [2,] 0.0024664457 0.0026615183 0.0011285264 1.002025e-02 #> [3,] 0.0005732818 0.0005787961 0.0002823266 1.677763e-03 #> [4,] 0.0004872805 0.0004929725 0.0002394680 6.262659e-04 #> [5,] 0.0004059066 0.0004099744 0.0001998165 3.201787e-04 #> [6,] 0.0003447286 0.0003475734 0.0001700069 1.933725e-04 #> [7,] 0.0002986627 0.0003006772 0.0001475152 1.293954e-04 #> [8,] 0.0029389397 0.0072216015 0.0014680343 1.548152e-04 #> [9,] 0.0008168502 0.0015704700 0.0014680343 1.166482e-04 #> [10,] 0.0033835974 0.0091593329 0.0017451837 1.422614e-04 #> [11,] 0.0011873999 0.0019918653 0.0006438778 1.145119e-04 #> [12,] 0.0010225858 0.0016965126 0.0006438778 9.432408e-05 #> [13,] 0.0008785607 0.0014108836 0.0006438778 7.916885e-05 #> [14,] 0.0007679398 0.0011961369 0.0005497556 6.749313e-05 #> [15,] 0.0006820264 0.0010347488 0.0005497556 5.830055e-05 ``` -------------------------------- ### LONDstar with Batch Version Source: https://dsrobertson.github.io/onlineFDR/reference/LONDstar.html Illustrates using the LONDstar function in 'batch' mode with specified batch sizes. This is suitable for processing data in chunks. ```R sample.df3 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) LONDstar(sample.df3, version='batch', batch.sizes = c(4,6,5)) ``` -------------------------------- ### SAFFRON with Default Randomization Source: https://dsrobertson.github.io/onlineFDR/reference/SAFFRON.html This snippet shows the SAFFRON function using its default randomization settings. Ensure 'set.seed(1)' is called for reproducible results. ```R set.seed(1); SAFFRON(sample.df) #> pval alphai R id #> 1 2.9000e-08 0.005468627 1 A15432 #> 2 6.7430e-02 0.010937254 0 B90969 #> 3 1.5140e-02 0.010937254 0 C18705 #> 4 8.1740e-02 0.010937254 0 B49731 #> 5 1.7100e-03 0.010937254 1 E99902 #> 6 2.7201e-01 0.021874508 0 D46627 #> 7 3.6000e-05 0.021874508 1 C38292 #> 8 7.9149e-01 0.032811762 0 A30619 #> 9 7.5900e-08 0.010823845 1 A41418 #> 10 2.8295e-01 0.021761099 0 E29198 #> 11 6.9274e-01 0.021761099 0 D51456 #> 12 7.2342e-01 0.009265591 0 A63155 #> 13 3.0443e-01 0.005456418 0 C88669 #> 14 5.4757e-01 0.005456418 0 B66033 #> 15 1.3600e-03 0.003688669 1 E03673 ```