jgscott / fdrreg Goto Github PK
View Code? Open in Web Editor NEWFalse discovery rate regression
False discovery rate regression
Hi,
I'm trying to run FDRreg
with default parameters except for nulltype='empirical'. However, I get many warnings like the following:
f(z) misfit = -0.2. Rerun with increased df.
I think I have tracked this down to the efron
function call. It seems to be an issue with the fitting of the empirical Z-score distribution. The warning suggests to run with an increased degrees of freedom, which is taken from the control
input list (specifically, the densknots
parameter, default value is 10). I tried to get advice for how much to increase this parameter from the documentation, but was a bit confused by the help file for FDRreg
, which says:
nmids, densknots: Only used if method='efron'; this functionality is retained for legacy reasons and is not recommended for actual data analysis. nmids: How many histogram midpoints are used in Efron's spline-based estimator of f(z). Defaults to 150. densknots: how many spline knots. Defaults to 10.
Is the 'empirical' null type not recommended for actual data analysis? If it is, do you have any practical advice for how to set this densknots
parameter?
Thanks in advance,
Keegan
Hi, I tried to install FDRreg v0.2 using devtools::install_github('jgscott/FDRreg', subdir="R_pkg/"), but I got the following error.
Error: HTTP error 404.
Not Found
Did you spell the repo owner (jgscott
) and repo name (FDRreg
) correctly?
Thanks!
Ling
Hi,
I am running into the error M0 > 0 are not all TRUE
using nulltype = "empirical"
with the additional warning Warning message: In sqrt(-1/{ : NaNs produced
. Looks like this is thrown from the following line of the efron() function
:
sig = as.numeric(sqrt(-1/{ 2 * b0[3] }))
I’m not sure what this line is doing, or why it expects that b0[3]
is negative, so I'm not sure how to fix.
Here’s a toy reproducible example where it occurs - when the test statistics look a bit bimodal (but I’m not sure if this is the only type of scenario):
set.seed(57)
res <- FDRreg::FDRreg(c(rnorm(500,1,0.8), rnorm(500,-1,0.8)),
features = model.matrix( ~ splines::bs(rnorm(1000), df = 3) - 1),
nulltype = 'empirical’)
Please let me know if this can be resolved. Thanks!
Best,
Keegan
Hi,
Just a heads up - I was just trying to install FDRreg and was unable due to the dependency on the package BayesLogit
which was removed from CRAN (https://cran.r-project.org/web/packages/BayesLogit/index.html).
Best,
Keegan
I am hoping to use the results from a previous test (Z1) to re-weight the p-values from a new-related test (Z2). However, when I run FDRreg (as shown below), I end up with FDRreg-corrected results that do not seem to incorporate the information from the covariate Z1 distribution. For example, a result that was significant at Q < 0.05 had a very large Z stat in Z2 and a large but NEGATIVE Z stat in Z1. In fact, it seems like the Q-values are in the same order as the original p-values from Z2. This leads me to believe that the info from Z1 isn't being incorporated properly.
The main file is attached:
library(FDRreg)
dat=read.table("independent_aligned_effects.txt",header=T)
#convert p to z
dat$Z1 = (1 - qnorm(dat$P1)) * sign(dat$BETA1)
dat$Z2 = (1 - qnorm(dat$P2)) * sign(dat$BETA2)
dat2=dat[complete.cases(dat),]
fdr1 = FDRreg(dat2$Z2, as.matrix(dat2$Z1), nulltype="theoretical")
#get the subset of significant SNPs
Q=0.05
fdrout=fdr1$FDR
tmp=cbind(dat2,fdrout)
outmat=subset(tmp, fdrout < Q)
nrow(outmat) #8403
write.table(outmat, file="fdrreg_corrected.txt", quote=F, row.names=F)
Many of the test declared significant at Q have Z-scores in the opposite direction. For example:
subset(outmat, SNP == "rs35238445", select=c(Z1,Z2,fdrout))
Z1 Z2 fdrout
33471 -0.3448948 5.183861 0.001698456
sessionInfo()
R version 3.2.4 (2016-03-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.3 (Santiago)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] splines stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] FDRreg_0.2-1 mvtnorm_1.0-5 BayesLogit_0.5.1 fda_2.4.4
[5] Matrix_1.2-4
loaded via a namespace (and not attached):
[1] Rcpp_0.12.4 magrittr_1.5 MASS_7.3-45 munsell_0.4.3
[5] colorspace_1.2-6 lattice_0.20-33 R6_2.1.2 ggdendro_0.1-18
[9] minqa_1.2.4 mosaicData_0.13.0 stringr_1.0.0 car_2.1-2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.