Description Usage Arguments Value Note Author(s) Examples
Given a vector of disease probabilities and a number of diseased individual, Calculated the mid-p values based on the Poisson-Binomial distribution
1 | poibin.midp(n.carrier, n.D.carrier, prob.vec)
|
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. |
a single numeric variable - a p-value for the test that the number n.D.carrier is consistent with prob.vec.
Althouth n.carrier is not strictly needed, but is useful for quality checks, especially when meta-analyzing.
Tamar Sofer
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)] )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.