X3: X3

Description Usage Arguments Details Value Author(s) Examples

View source: R/single_snps.R

Description

Compute test statistic X3, weighted geometric mean of Z_a and Z_d

Usage

1
X3(Z, pars = NULL, tau = NULL, sigma = NULL, alpha = NULL)

Arguments

Z

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

pars

set of parameters of full model

tau

value of tau used to compute alpha. Overrides parameter pars if set

sigma

value of sigma used to compute alpha. Overrides parameter pars if set

alpha

value of alpha set directly. Overrides parameters tau, sigma and pars if set.

Details

Defined as X3=Z_d^(alpha) Z_a^(1-alpha). Alpha is chosen to prioritise SNPs with high Z_d values (ie separating subtypes) over those with high Z_a (associated with phenotype.

Parameter alpha may be specified directly, or a 'good' value may be chosen from parameters. The value is chosen, given tau and sigma values, such that the points (tau,1) and (1,sigma) have the same value of X3. If no parameters are set, alpha defaults to 0.5. The parameter alpha is defined as a global variable at the end of the function.

Value

vector of values of X3 and set alpha as a global variable

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=X3(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.