BRtest: Tests the association between a set of variants and disease...

Description Usage Arguments Details Value Author(s) Examples

Description

Tests a set of variants represented in the numberical matrix G, given disease status and previously estimated probabilities of disease.

Usage

1
BRtest(d, probs, G)

Arguments

d

An n vector of disease status

probs

An n vector of (estimated) disease probabilities corresponding to the individuals with disease status.

G

An nxp matrix of counts of (assumed rare) p variants genotpyed on n individuals. Columns correspond to variants, rows to individuals.

Details

For each variant, calculates the expected number of disease individuals among the carriers, and calculates p-value from the BinomiRare test of association between the variant and the disease status.

Value

The function returns a data frame with variant name, the number of carriers of the variant, number of diseased carriers, the expected number of diseased carriers (according to the supplied probabilities), and p-value.

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
24
25
26
27
28
require(poibin)

##########  Example 1:  a single data set.
########## Simulate data
n <- 10000
effect.size <- 1
pop.risk <- -2.6

x <- rnorm(n, sd = 0.01)
x <- pmax(x, 0)
	
g <- rbinom(n, size = 2, prob = x)  ## one causal variant, x is a confounder
G <- matrix(rbinom(n*100, size = 1, prob = 0.001), nrow = n)  ### another 100 null variants
G <- cbind(g, G)
colnames(G) <- paste0("var_", 1:ncol(G))
rownames(G) <- paste0("person_", 1:nrow(G))
p <- expit(pop.risk +   g*effect.size + 20*x)
d <- rbinom(n, 1, p) 
names(d) <- paste0("person_", 1:nrow(G))


########### Now that we have outcome d, genotypes G and a covariate x: 
########### Estimate disease probability model

prob.mod <- glm(d ~ x, family = binomial)
prob.d <- expit(predict(prob.mod))

system.time(res <- BRtest(d, prob.d, G)) ### super quick

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