poibin.midp: Calculated the mid-p values based on the Poisson-Binomial...

Description Usage Arguments Value Note Author(s) Examples

Description

Given a vector of disease probabilities and a number of diseased individual, Calculated the mid-p values based on the Poisson-Binomial distribution

Usage

1
poibin.midp(n.carrier, n.D.carrier, prob.vec)

Arguments

n.carrier

The number of carriers of a rare variant

n.D.carrier

The number of diseased carriers of a rare variant. n.D.carrier cannot be larger than n.carrier.

prob.vec

vector of disease probabilities of the carriers.

Value

a single numeric variable - a p-value for the test that the number n.D.carrier is consistent with prob.vec.

Note

Althouth n.carrier is not strictly needed, but is useful for quality checks, especially when meta-analyzing.

Author(s)

Tamar Sofer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require(poibin)
	n <- 100

	### simulation under the null
	g <- rbinom(n, 2, 0.1)
	x <- rnorm(n)
	p <- expit(-2.3 + x)
	d <- rbinom(n, size = 1, prob = p)
	
	mod <- glm(d ~ x, family = "binomial")
	prob.d <- expit(predict(mod))
	poibin.midp(n.carrier = sum(g >0 ), n.D.carrier = sum(g*d > 0), 
		prob.vec = prob.d[which(g>0)] )
	
	##### under the alternative:	
	p <- expit(-2.3 + x + g)
	d <- rbinom(n, size = 1, prob = p)
	
	mod <- glm(d ~ x, family = "binomial")
	prob.d <- expit(predict(mod))
	poibin.midp(n.carrier = sum(g >0 ), n.D.carrier = sum(g*d > 0),
		prob.vec = prob.d[which(g>0)] )
	

tamartsi/BinomiRare documentation built on May 31, 2019, 2:56 a.m.