Wakefield's log asymptotic Bayes factor (lABF) with prior standard deviation of effect size as a parameter

approx.bf.p(pvals, f, type, N, s, W = 0.2)

Arguments

pvals

P-values

f

Minor allele frequencies

type

Type of experiment ('quant' or 'cc')

N

Total sample size

s

Proportion of cases (N1/N0+N1), ignored if type=='quant'

W

Prior for the standard deviation of the effect size parameter beta (W=0.2 default)

Value

data.frame containing lABF and intermediate calculations

Details

([Wakefield et al. 2009](https://onlinelibrary.wiley.com/doi/abs/10.1002/gepi.20359) This function converts p-values to log ABFs, also reporting intermediate calculations

Examples

set.seed(1) nsnps = 100 N0 = 5000 N1 = 5000 z_scores <- rnorm(nsnps, 0, 3) p_values <- 2 * pnorm( - abs ( z_scores ) ) ## generate example LD matrix and MAFs library(mvtnorm) nsamples = 1000 simx <- function(nsnps, nsamples, S, maf=0.1) { mu <- rep(0,nsnps) rawvars <- rmvnorm(n=nsamples, mean=mu, sigma=S) pvars <- pnorm(rawvars) x <- qbinom(1-pvars, 1, maf) } S <- (1 - (abs(outer(1:nsnps,1:nsnps,`-`))/nsnps))^4 X <- simx(nsnps,nsamples,S) maf <- colMeans(X) approx.bf.p(pvals = p_values, f = maf, type = "cc", N = N0+N1, s = N1/(N0+N1))
#> V z r lABF #> 1 0.002599293 1.879361432 0.9389827 0.259944111 #> 2 0.002517909 0.550929973 0.9407800 -1.270473777 #> 3 0.002599293 2.506885837 0.9389827 1.552208379 #> 4 0.002781022 4.785842406 0.9349940 9.341047932 #> 5 0.002571520 0.988523315 0.9395953 -0.944268001 #> 6 0.002442002 2.461405152 0.9424626 1.427301994 #> 7 0.002283340 1.462287157 0.9459991 -0.447969805 #> 8 0.002304572 2.214974115 0.9455243 0.864423167 #> 9 0.002394177 1.727344055 0.9435258 -0.029378459 #> 10 0.002466730 0.916165161 0.9419138 -1.027612048 #> 11 0.002348410 4.535343505 0.9445455 8.268242890 #> 12 0.002183501 1.169529709 0.9482380 -0.832049849 #> 13 0.002371045 1.863721742 0.9440409 0.197976322 #> 14 0.002442002 6.644099662 0.9424626 19.374402884 #> 15 0.002371045 3.374792754 0.9440409 3.934380483 #> 16 0.002442002 0.134800827 0.9424626 -1.419097192 #> 17 0.002242178 0.048570789 0.9469209 -1.466868876 #> 18 0.002326258 2.831508632 0.9450398 2.337827252 #> 19 0.002059329 2.463663585 0.9510375 1.377876401 #> 20 0.002202667 1.781703964 0.9478074 0.027985426 #> 21 0.002242178 2.756932115 0.9469209 2.130632955 #> 22 0.002146291 2.346408902 0.9490752 1.123928032 #> 23 0.002042901 0.223694950 0.9514091 -1.488355879 #> 24 0.002222222 5.968055088 0.9473684 15.399313866 #> 25 0.002394177 1.859477244 0.9435258 0.194207970 #> 26 0.002183501 0.168386219 0.9482380 -1.467106578 #> 27 0.002128226 0.467386520 0.9494822 -1.389007422 #> 28 0.002010940 4.412257152 0.9521330 7.748404451 #> 29 0.002010940 1.434450165 0.9521330 -0.540087117 #> 30 0.001880424 1.253824681 0.9551002 -0.800915466 #> 31 0.001950382 4.076038655 0.9535074 6.386598347 #> 32 0.001893939 0.308363182 0.9547920 -1.502846526 #> 33 0.001935902 1.163014835 0.9538366 -0.892703013 #> 34 0.001950382 0.161415122 0.9535074 -1.521809335 #> 35 0.002059329 4.131178670 0.9510375 6.607155676 #> 36 0.002076067 1.244983690 0.9506592 -0.767748454 #> 37 0.001980120 1.182869861 0.9528320 -0.860427213 #> 38 0.001935902 0.177940190 0.9538366 -1.522683876 #> 39 0.002059329 3.300076116 0.9510375 3.670287713 #> 40 0.001935902 2.289527245 0.9538366 0.962190427 #> 41 0.002146291 0.493570789 0.9490752 -1.373099565 #> 42 0.001995391 0.760085040 0.9524855 -1.248220640 #> 43 0.002202667 2.090890126 0.9478074 0.595415202 #> 44 0.001965119 1.669989596 0.9531726 -0.201508038 #> 45 0.001995391 2.066267084 0.9524855 0.509939166 #> 46 0.002128226 2.122485471 0.9494822 0.645967635 #> 47 0.002146291 1.093745886 0.9490752 -0.921022804 #> 48 0.002076067 2.305598774 0.9506592 1.022248367 #> 49 0.002110506 0.337038636 0.9498817 -1.442733815 #> 50 0.002110506 2.643323179 0.9498817 1.821801820 #> 51 0.002146291 1.194317641 0.9490752 -0.811824791 #> 52 0.002093123 1.836079180 0.9502740 0.101161970 #> 53 0.002202667 1.023359074 0.9478074 -0.980104986 #> 54 0.002242178 3.388089288 0.9469209 3.966937123 #> 55 0.002093123 4.299071105 0.9502740 7.280874246 #> 56 0.002146291 5.941199696 0.9490752 15.261456261 #> 57 0.002128226 1.101664429 0.9494822 -0.916538268 #> 58 0.002183501 3.132403879 0.9482380 3.171484247 #> 59 0.002110506 1.709158882 0.9498817 -0.109276062 #> 60 0.002164713 0.405163812 0.9486606 -1.406782972 #> 61 0.002394177 7.204853282 0.9435258 23.052184326 #> 62 0.002262546 0.117720008 0.9464645 -1.457147250 #> 63 0.002164713 2.069218087 0.9486606 0.546274685 #> 64 0.002262546 0.084006476 0.9464645 -1.460365661 #> 65 0.002128226 2.229819627 0.9494822 0.867743410 #> 66 0.001995391 0.566376899 0.9524855 -1.370589535 #> 67 0.002076067 5.414875887 0.9506592 12.432580567 #> 68 0.002010940 4.396664585 0.9521330 7.683014958 #> 69 0.002183501 0.459760015 0.9482380 -1.380330779 #> 70 0.002076067 6.517835011 0.9506592 18.688532357 #> 71 0.002304572 1.426528587 0.9455243 -0.492936744 #> 72 0.002164713 2.129839293 0.9486606 0.667016367 #> 73 0.002222222 1.832179060 0.9473684 0.117881615 #> 74 0.002262546 2.802292895 0.9464645 2.252514493 #> 75 0.002348410 3.760900201 0.9445455 5.233904471 #> 76 0.002183501 0.874338707 0.9482380 -1.118100815 #> 77 0.002202667 1.329875620 0.9478074 -0.638275707 #> 78 0.002128226 0.003316055 0.9494822 -1.492709470 #> 79 0.002222222 0.223023972 0.9473684 -1.448658583 #> 80 0.002164713 1.768562839 0.9486606 -0.001030821 #> 81 0.002262546 1.706006198 0.9464645 -0.086383093 #> 82 0.002417824 0.405535845 0.9429998 -1.354807751 #> 83 0.002326258 3.534260990 0.9450398 4.451673295 #> 84 0.002371045 4.570700401 0.9440409 8.419554766 #> 85 0.002183501 1.781838563 0.9482380 0.024753811 #> 86 0.002222222 0.998851114 0.9473684 -0.999623072 #> 87 0.002183501 3.189299512 0.9482380 3.342014100 #> 88 0.002283340 0.912551771 0.9459991 -1.065486305 #> 89 0.002348410 1.110056430 0.9445455 -0.864149744 #> 90 0.002371045 0.801296372 0.9440409 -1.138494311 #> 91 0.002222222 1.627560093 0.9473684 -0.217452821 #> 92 0.002348410 3.623603418 0.9445455 4.755081967 #> 93 0.002202667 3.481207847 0.9478074 4.266740749 #> 94 0.002348410 2.100640949 0.9445455 0.637898200 #> 95 0.002442002 4.760500364 0.9424626 9.251555061 #> 96 0.002326258 1.675459277 0.9450398 -0.124132598 #> 97 0.002262546 3.829776625 0.9464645 5.477281671 #> 98 0.002283340 1.719796243 0.9459991 -0.060386708 #> 99 0.002394177 3.673837845 0.9435258 4.930438044 #> 100 0.002517909 1.420201909 0.9407800 -0.464484167