library(pwr)
library(ggplot2)
<- expand.grid(
param N = 500000,
Fdisc = qf(10^-c(8:30), 1, 500000, low=FALSE),
nsig = c(1, 10, 100)
)
$r2 = param$Fdisc / param$N
param$validate_alpha = 0.05 / param$nsig
param$validate_r2 = sapply(1:nrow(param), \(i) {
parampwr.r.test(param$N[i], sig.level=param$validate_alpha[i], power=0.8)$r^2
})$prs_r2 = param$validate_r2 / param$r2
param
ggplot(param, aes(x=-log10(pf(Fdisc, 1, 500000, low=F)), y=prs_r2)) +
geom_point(aes(colour=as.factor(nsig))) +
geom_line(aes(colour=as.factor(nsig))) +
theme_bw() +
labs(x="Discovery -log10 p-value", y = "Minimim cor(y,PRS)^2 needed for polygenic confounding to be detected", colour="Number of GWAS\nhits to test")
Background
Given that a variant associates with a trait due to polygenic confounding, what is the minimum \(R^2\) of the PRS required to detect polygenic confounding with 80% power?
sessionInfo()
R version 4.4.3 (2025-02-28)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.6.1
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Europe/London
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_3.5.1 pwr_1.3-0
loaded via a namespace (and not attached):
[1] vctrs_0.6.5 cli_3.6.3 knitr_1.48 rlang_1.1.4
[5] xfun_0.48 generics_0.1.3 jsonlite_1.8.9 labeling_0.4.3
[9] glue_1.8.0 colorspace_2.1-1 htmltools_0.5.8.1 scales_1.3.0
[13] fansi_1.0.6 rmarkdown_2.27 grid_4.4.3 evaluate_1.0.1
[17] munsell_0.5.1 tibble_3.2.1 fastmap_1.2.0 yaml_2.3.10
[21] lifecycle_1.0.4 compiler_4.4.3 dplyr_1.1.4 htmlwidgets_1.6.4
[25] pkgconfig_2.0.3 farver_2.1.2 digest_0.6.37 R6_2.5.1
[29] tidyselect_1.2.1 utf8_1.2.4 pillar_1.9.0 magrittr_2.0.3
[33] withr_3.0.2 tools_4.4.3 gtable_0.3.6