X2: X2

Description Usage Arguments Value Author(s) Examples

View source: R/single_snps.R

Description

Compute test statistic X2, difference in pseudolikelihood of each SNP between full and null model.

Usage

1
X2(Z, pars1, pars0, cond = TRUE)

Arguments

Z

n x 2 matrix of Z scores; Z[,1]=Z_d, Z[,2]=Z_a

pars1

parameters of full model; in order, pi0, pi1, tau, sigma_1, sigma_2, rho

pars0

parameters of null model; in order, pi0, pi1, tau, sigma_1, sigma_2, rho

cond

adjust for difference in likelihood of Z_a; 'conditional' pseudolikelihood difference

Value

vector of values of X2

Author(s)

James Liley

Examples

1
2
3
4
5
nn=100000
Z=abs(rbind(rmnorm(0.8*nn,varcov=diag(2)), rmnorm(0.15*nn,varcov=rbind(c(1,0),c(0,2^2))), rmnorm(0.05*nn,varcov=rbind(c(3^2,2),c(2,4^2)))));
pars1=c(0.8,0.15,3,2,4,2); pars0=c(0.8,0.1,3,4,1,0)
X=X2(Z,pars1,pars0,cond=TRUE); X[which(X<0)]=0; X[which(X>1)]=1
plotZ(Z,rlim=2,col=gray(X)); 

jamesliley/subtest documentation built on May 18, 2019, 11:21 a.m.