lrt: Likelihood Ratio Tests for Identifying Number of Functional...

Description Usage Arguments Value See Also Examples

View source: R/lrt.R

Description

Compute p-values and likelihoods of all possible models for a given number of functional SNP(s).

Usage

1
 lrt(n.fp, n, x, geno, no.con=nrow(geno))

Arguments

n.fp

number of functional SNPs for tests.

n

array of each total number of case sample chromosomes for SNPs

x

array of each total allele number in case samples

geno

matrix of alleles, such that each locus has a pair of adjacent columns of alleles, and the order of columns corresponds to the order of loci on a chromosome. If there are K loci, then ncol(geno) = 2*K. Rows represent the alleles for each subject. Each allele shoud be represented as numbers (A=1,C=2,G=3,T=4).

no.con

number of control chromosomes.

Value

matrix of likelihood ratio test results. First n.fp rows indicate the model for each set of disease polymorphisms, and followed by p-values, -2 log(likelihood ratio) with corrections for variances, maximum likelihood ratio estimates, and likelihood.

See Also

allele.freq hap.freq

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## LRT tests when SNP1 & SNP6 are the functional polymorphisms.

data(apoe)

n<-c(2000, 2000, 2000, 2000, 2000, 2000, 2000) #case sample size = 1000
x<-c(1707, 281,1341, 435, 772, 416, 1797) #allele numbers in case samples 


Z<-2 	#number of functional SNPs for tests
n.poly<-ncol(apoe7)/2 	#total number of SNPs

#control sample generation( sample size = 1000 )
con.samp<-sample(nrow(apoe7),1000,replace=TRUE)
con.data<-array()
for (i in con.samp){
con.data<-rbind(con.data,apoe7[i,])
}
con.data<-con.data[2:1001,]

lrt(1,n,x,con.data)
lrt(2,n,x,con.data)

Example output

               lr2       mle likelihood
[1,] 1 1  99.05060 -6973.191  -7065.578
[2,] 2 1 134.91427 -6973.191  -7181.347
[3,] 3 1 129.31469 -6973.191  -7180.150
[4,] 4 1  94.25802 -6973.191  -7154.132
[5,] 5 1 112.37384 -6973.191  -7183.335
[6,] 6 1  53.21378 -6973.191  -7094.803
[7,] 7 1 148.20471 -6973.191  -7175.570
                             lr2       mle likelihood
 [1,] 1 2 1.00000000  97.6462239 -6973.191  -7064.641
 [2,] 1 3 1.00000000  78.1240919 -6973.191  -7059.705
 [3,] 1 4 1.00000000  87.4768617 -6973.191  -7068.021
 [4,] 1 5 1.00000000  64.9266392 -6973.191  -7050.300
 [5,] 1 6 0.00327529   0.3443556 -6973.191  -6973.644
 [6,] 1 7 1.00000000  97.3021923 -6973.191  -7061.599
 [7,] 2 3 1.00000000 126.3909501 -6973.191  -7180.336
 [8,] 2 4 1.00000000  86.9690090 -6973.191  -7148.795
 [9,] 2 5 1.00000000 106.6531083 -6973.191  -7183.342
[10,] 2 6 1.00000000  48.3817726 -6973.191  -7093.126
[11,] 2 7 1.00000000 150.1647358 -6973.191  -7172.408
[12,] 3 4 0.99741512  18.3073472 -6973.191  -7076.314
[13,] 3 5 1.00000000 100.5722103 -6973.191  -7164.948
[14,] 3 6 1.00000000  47.4605011 -6973.191  -7082.704
[15,] 3 7 1.00000000 135.2144742 -6973.191  -7174.706
[16,] 4 5 0.99996456  28.0595147 -6973.191  -7089.387
[17,] 4 6 0.99999942  37.0662353 -6973.191  -7077.185
[18,] 4 7 1.00000000  96.5886453 -6973.191  -7153.873
[19,] 5 6 1.00000000  47.6909200 -6973.191  -7092.354
[20,] 5 7 1.00000000 119.1776788 -6973.191  -7173.057
[21,] 6 7 1.00000000  53.1753661 -6973.191  -7094.799

IFP documentation built on May 29, 2017, 9:07 p.m.