m0.bdn() example run, fdr
#simulate 1000 p-vlaues from a mixture beta and uniform distribution.
p = rbunif(1000, alpha=1, beta=29, gamma=0.7)
#estimate m0 using the method in Story and Tibshirani (2003).
m0.st(p)
#estimate m0 using the method in Nettleton et al. (2006)
m0.nhcw(p)
# ---------- a real example in Bancroft, Du and Nettleton (2013) --------------
# read in C++ source code
tsf_code = read_code("test_statistics.cpp")
# genrate function for sequential permutation test
# for no location difference between two samples
if(!exists("cxxspt.mean")){
cxxwrapper(tsf_code, "abs_mean_diff0", "abs_mean_diff", c("n1", "", "int")) -> cxxspt.mean
}
# download data
if(!file.exists('spt_data.rda')){
download.file('http://dclong.github.io/media/spt/spt_data.rda', 'spt_data.rda')
}
load('spt_data.rda')
cxxspt.mean(leukemia, 10, 1000, n1=5) -> cxxspt.out
#estimate m0 using the method in Bancroft, Du and Nettleton (2013).
m0.bdn(cxxspt.out, 20)
Using a example dataset of 1000 points
From qvalue(), $\pi_0$ = 0.662.
No comments:
Post a Comment