Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FDRreg doesn't seem to be incorporating my covariate #1

Open
dhibar opened this issue Apr 12, 2016 · 0 comments
Open

FDRreg doesn't seem to be incorporating my covariate #1

dhibar opened this issue Apr 12, 2016 · 0 comments

Comments

@dhibar
Copy link

dhibar commented Apr 12, 2016

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

independent_aligned_effects.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant