getSigma: Covariance matrix and correlation estimation for repeated...

Description Usage Arguments Value Author(s) References Examples

View source: R/getSigma.R

Description

getRho is an implementation of the proposed moment estimator (see reference) for estimating the unknown correlation in repeated measurements. Based on the output from getRho, the getSigma function returns an estimated covariance matrix.

Usage

1
2
getSigma(YY, xx, id, weights=NULL, correction=TRUE)
getRho(YY, xx, id, weights, correction=TRUE, return.all=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.

id

Vector of subject IDs (for repeated measurements).

weights

Vector of a priori weights. If NULL, equal weights of 1 will be assigned.

correction

Logical value. If TRUE, the correlation estimate is corrected by the Olkin and Pratt's method for downward bias in small samples.

return.all

Logical value. If TRUE, individual correlation estimates for each column of the reponse matrix are returned. If FALSE, average correlation across columns of the reponse matrix is returned. In getSigma(), the average correlation is used.

Value

The getSigma function returns a variance-covariance matrix based on the correlation and weights.

The getRho function returns the individual or average correlation estimate(s).

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(PBtest)
data(sim1)

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

rho.hat <- getRho(YY=simdat, xx=Grp, id=Subj, weights=ww)
rho.all <- getRho(YY=simdat, xx=Grp, id=Subj, weights=ww, return.all=TRUE)
## Given the true correlation is 0.2, the mean square error is
mse <- mean((rho.all-0.2)^2)

## Sigma matrix
Sigma <- getSigma(YY=simdat, xx=Grp, id=Subj, weights=ww)

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