px3: px3

Description Usage Arguments Details Value Author(s) Examples

View source: R/single_snps.R

Description

Compute the probability of X3 exceeding some threshold under a null hypothesis H0

Usage

1
2
px3(X3c, alpha = NULL, pars = NULL, pi = NULL, tau = NULL,
  sigma = NULL, xmax = 12, res = 0.05)

Arguments

X3c

vector of X3 cutoffs at which to calculate probability

alpha

value of alpha used in computing X3; recalculated if NULL

pars

parameters in null model

pi

two-element vector c(pi1,pi2); overrides pars if set. If pars and pi are null, defaults to (1/3, 1/3)

tau

value in null distribution of Z; overrides pars if set. If pars and tau are null, defaults to 1.

sigma

value in null distribution of Z; overrides pars if set. If pars and sigma are null, defaults to 1.

xmax

compute integral over [0,xmax] x [0,xmax] as approximation to [0,inf] x [0,inf]

res

compute integral at gridpoints with this spacing.

Details

H0 is defined as Z=(Z_d,Z_a) having a mixture distribution of N(0,I2) with probability pi0, N(0,(1,0 // 0,sigma)) with probability pi1 and N(0, (tau,0 // 0,1)) with probability pi2. Parameters pi1, pi2, tau and sigma can be derived from the fitted null model or set.

The p value is dependent on the value of alpha used to compute X3. If this is not specified in the function call, it is recalculated according to the same rules as the function X3

The probability is computed using a numerical integral over the (+/+) quadrant and the range and resolution of the integral can be set.

Value

vector of p-values corresponding to X3c

list of probabilities

Author(s)

James Liley

Examples

1
2
3
4
5
6
nn=100000
Z=abs(rbind(rmnorm(0.8*nn,varcov=diag(2)), rmnorm(0.1*nn,varcov=rbind(c(1,0),c(0,2^2))), rmnorm(0.1*nn,varcov=rbind(c(3^2,0),c(0,1))))); pars=c(0.8,0.1,2,3,1,0)
X=X3(Z,pars=pars)
subX=order(runif(nn))[1:500]
pX=px3(X[subX],alpha=alpha,pars=pars)
plot((1:length(pX))/(1+length(pX)),sort(pX),xlab="Quantile in U[0,1]",ylab="Observed quantile",main="Q-Q plot")

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