Skip to content

Commit 130956c

Browse files
danmacleanclaude
andcommitted
Document bayes_t incompatibility with FDR mode
- Update roxygen docs for apply_fdr parameter - Fix prm-genotype-power vignette to use wilcoxon for FDR example - Add explanatory note to power-analysis-workflow vignette Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e865491 commit 130956c

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

R/power.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ power_analysis.default <- function(distribution, ...) {
129129
#' @param on_fit_failure How to handle failed fits: "exclude", "empirical", or "lognormal"
130130
#' @param proportion_threshold Proportion of peptides that must reach target_power (default 0.5)
131131
#' @param include_missingness If TRUE, incorporate peptide-specific NA rates into simulations
132-
#' @param apply_fdr If TRUE, use FDR-aware simulation with Benjamini-Hochberg correction
132+
#' @param apply_fdr If TRUE, use FDR-aware simulation with Benjamini-Hochberg correction.
133+
#' Note: not compatible with `test = "bayes_t"` (Bayes factors cannot be converted to p-values)
133134
#' @param prop_null Proportion of true null peptides (default 0.9 = 90% unchanged)
134135
#' @param fdr_threshold FDR threshold for calling discoveries (default 0.05)
135136
#' @param ... Additional arguments (ignored)

man/power_analysis.peppwr_fits.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/articles/power-analysis-workflow.Rmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ print(result_fdr)
643643
```
644644

645645
The `apply_fdr` mode simulates entire experiments with a mixture of null and alternative peptides, then applies Benjamini-Hochberg correction before computing power.
646+
**Note:** FDR-adjusted mode requires frequentist tests (`wilcoxon` or `bootstrap_t`). The `bayes_t` test is not compatible with FDR mode because Bayes factors cannot be converted to p-values for BH correction.
646647

647648
### Understanding prop_null
648649

vignettes/articles/prm-genotype-power.Rmd

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,16 +388,18 @@ In targeted proteomics, you typically select peptides expected to change, so `pr
388388

389389
### Standard vs FDR-Corrected Power
390390

391+
Note: FDR-aware mode requires frequentist tests (Wilcoxon or bootstrap-t) because Benjamini-Hochberg correction operates on p-values. Bayes factors cannot be meaningfully converted to p-values for this correction.
392+
391393
```{r power-fdr}
392-
# Standard power (nominal alpha = 0.05)
394+
# Standard power with Wilcoxon (nominal alpha = 0.05)
393395
power_nominal <- power_analysis(fits, effect_size = 2, n_per_group = 3,
394-
find = "power", test = "bayes_t",
396+
find = "power", test = "wilcoxon",
395397
apply_fdr = FALSE, n_sim = 100)
396398
397399
# FDR-aware power (BH correction)
398400
# prop_null = 0.8 means we assume 80% of peptides have no true effect
399401
power_fdr <- power_analysis(fits, effect_size = 2, n_per_group = 3,
400-
find = "power", test = "bayes_t",
402+
find = "power", test = "wilcoxon",
401403
apply_fdr = TRUE, prop_null = 0.8,
402404
fdr_threshold = 0.05, n_sim = 100)
403405
```
@@ -407,15 +409,15 @@ power_fdr <- power_analysis(fits, effect_size = 2, n_per_group = 3,
407409
nominal_power <- power_nominal$simulations$peptide_power
408410
fdr_power <- power_fdr$simulations$peptide_power
409411
410-
cat("Nominal power (no FDR correction):\n")
412+
cat("Nominal power (Wilcoxon, no FDR correction):\n")
411413
if (is.numeric(nominal_power) && length(nominal_power) > 0) {
412414
cat(" Median power:", round(median(nominal_power, na.rm = TRUE), 3), "\n")
413415
cat(" % peptides > 80% power:", round(mean(nominal_power > 0.8, na.rm = TRUE) * 100, 1), "%\n")
414416
} else {
415417
print(power_nominal)
416418
}
417419
418-
cat("\nFDR-aware power (BH correction, 80% true nulls):\n")
420+
cat("\nFDR-aware power (Wilcoxon, BH correction, 80% true nulls):\n")
419421
if (is.numeric(fdr_power) && length(fdr_power) > 0) {
420422
cat(" Median power:", round(median(fdr_power, na.rm = TRUE), 3), "\n")
421423
cat(" % peptides > 80% power:", round(mean(fdr_power > 0.8, na.rm = TRUE) * 100, 1), "%\n")

0 commit comments

Comments
 (0)