BFmixture: calculate BF with mixture prior.

Description Usage Arguments Value Examples

View source: R/Fun_mix_EM_15Jan2018_marg_lik.R

Description

calculate BF with mixture prior.

Usage

1
BFmixture(obs.data, nvariants, low.bound = 10^(-2))

Arguments

obs.data

N*2 data matrix, N is the sample size, 1st column is sum of rare variants for each individual, 2nd column is the disease status

nvariants

number of sites of the region

low.bound

lower bound

Value

Vector of 3 elements. 1st, probability of p=0; 2nd, precision parameter of beta distribution,3rd: BF

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
nsites = 500
ncase = 200
ncontrol = 200
maf = 0.005
rexp_param = 2

model1 = function(i) {
 
 p1 = rbinom( ncontrol  , nsites , maf   )
 p2 = rbinom( ncase     , nsites , maf )  + H1 * round(rexp(ncase,rexp_param))
 disease_status = c (  rep(0,ncontrol),rep(1,ncase)  )
 data = data.frame(c(p1,p2), disease_status)
 bf = BFmixture(data, nsites)[3]
 bf
}

nrep = 20

H1 = 0
bf1 = ( replicate(nrep,model1() ) )

H1 = 1
bf2 = ( replicate(nrep,model1() ) )

col = c( rep("blue",nrep) , rep("red", nrep))


plot(log(c(bf1,bf2)),col = col ,pch=20,cex=1.5)

adimitromanolakis/rareBF documentation built on July 24, 2019, 12:26 p.m.