PBtest: PB-transformed test

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/PBtest.R

Description

PBmap calculates the proposed transformations (see reference), i.e. B-map and P-map.

PBtest conducts the PB-transformed parametric or nonparametric test (see reference).

Usage

1
2
PBmap(xx, Sigma)
PBtest(YY, xx, Sigma=NULL, test="t", id=NULL, weights=NULL, debug=FALSE)

Arguments

YY

Vector or matrix of response values. If gene expression matrix, genes in columns and subjects in rows.

xx

Vector of covariate values.

Sigma

Vairance-covariance matrix.

test

Parametric or nonparametric test. Options: "t" (default), "wilcox".

id

Vector of subject IDs (for repeated measurements).

weights

Vector of a priori weights.

debug

Logical value. If TRUE, intermediate results are returned.

Value

A list of testing results:

p.value

P-value(s) of two-sided test.

statistic

Test statistic(s).

df

Adjusted degrees of freedom by KRapprox.

If debug=TRUE, the following intermediate results are also returned.

YY.tilde

PB-transformed data.

Sigma

Variance-covariance matrix.

sigma.sq

A scalar value. Dcompose the covariance matrix into a scale parameter and a shape parameter, such that Sigma=sigma.sq*SS.

SS.inv

Inverse of SS.

SS.tilde

Shape parameter after centering, i.e. SS - JJ, where JJ is the matrix of all 1's.

LL

Diagnal matrix of non-zero eigen-values of SS.tilde.

TT

Matrix of corresponding eigen-vectors of SS.tilde.

BB

B-map.

zz

Transformed covariate.

QQ

Q matrix of the QR decomposition.

RR

R matrix of the QR decomposition.

Rot

Rotation matrix by construction.

PP

P-map.

Note

Depending on different levels of a priori information, the following options are available.

1. If Sigma is known, set Sigma=Sigma and leave id=NULL, weights=NULL.

2. If Sigma is unknown, estimate using getSigma. In the arguments here, set Sigma=NULL, id=id, weights=weights or NULL. If weights=NULL, equal weights of 1 will be assigned.

3. If Sigma=NULL, id=NULL, weights=NULL, the identity matrix will be used for Sigma.

Author(s)

Yun Zhang, Xing Qiu

References

Zhang et al. (2019) Highly efficient hypothesis testing methods for regression-type tests with correlated observations and heterogeneous variance structure. BMC Bioinformatics, 20:185.

See Also

getSigma, KRapprox.

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
29
30
31
32
33
34
35
36
37
38
39
40
library(PBtest)
data(sim1)

## attach list elements to the global environment
list2env(sim1,globalenv())

## the PB-transformed t-test, with Sigma estimation
out.PB <- PBtest(YY=simdat, xx=Grp, test="t", id=Subj, weights=ww)
## p-values
pvec.PB <- out.PB$p.value
## degrees of freedom
df.PB <- out.PB$df

## estimated correlation
rho.hat.PB <- getRho(YY=simdat, xx=Grp, id=Subj, weights=ww)

## Sigma matrix
Sigma <- getSigma(YY=simdat, xx=Grp, id=Subj, weights=ww)
## or
Sigma <- PBtest(YY=simdat, xx=Grp, id=Subj, weights=ww, debug=TRUE)$Sigma

## the estimated correlation is also the off-diagonal non-zero value of the following matrix
cor.mat <- diag(sqrt(ww)) %*% Sigma %*% diag(sqrt(ww))

## the transformation maps
mymap <- PBmap(xx=Grp, Sigma)
Bmap <- mymap$BB
Pmap <- mymap$PP

## the PB-transformed data
simdat.PB <- PBtest(YY=simdat, xx=Grp, id=Subj, weights=ww, debug=TRUE)$YY.tilde
dim(simdat.PB) #this should have one less row than the original data dim(simdat)

## PBtest for two-sample t-test
out1.PB <- PBtest(YY=simdat, xx=Grp)
pvec1.PB <- out1.PB$p.value
df1.PB <- out1.PB$df
## two-sample t-test
pvec.t <- genefilter::colttests(simdat, Grp)$p.value
summary(pvec1.PB-pvec.t) #numerially same

yunzhang813/PBtest-R-Package documentation built on March 18, 2020, 5:29 p.m.