Title: | Robust Tests for Equal Correlation |
---|---|
Description: | There are 6 novel robust tests for equal correlation. They are all based on logistic regressions. The score statistic U is proportion to difference of two correlations based on different types of correlation in 6 methods. The ST1() is based on Pearson correlation. ST2() improved ST1() by using median absolute deviation. ST3() utilized type M correlation and ST4() used Spearman correlation. ST5() and ST6() used two different ways to combine ST3() and ST4(). We highly recommend ST5() according to the article titled ''New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs'' published in Scientific Reports. Please see the reference: Yu et al. (2019) <doi:10.1038/s41598-019-40167-8>. |
Authors: | Danyang Yu, Weiliang Qiu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss |
Maintainer: | Danyang Yu <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.7 |
Built: | 2024-12-21 06:39:54 UTC |
Source: | CRAN |
Construct differential correlation network with expressionSet,st5 is recommand for testing equal correlation.
construct_network(es, cor_method = "st5", var.grp, pseudo_adjust_cutoff = FALSE, pAdjMethod = 'fdr', cutoff = 0.05, nPseudo = 25)
construct_network(es, cor_method = "st5", var.grp, pseudo_adjust_cutoff = FALSE, pAdjMethod = 'fdr', cutoff = 0.05, nPseudo = 25)
es |
an ExpressionSet object of microRNA dataset |
cor_method |
a string represents the method for equal correlation, 'st5' is recommand. |
var.grp |
character. phenotype variable name indicating case-control status,0 as control, 1 as case. |
pseudo_adjust_cutoff |
if the value is TRUE, pseudo probes will be used for setting the cutoff of p-value for differential corrlation test. Otherwise, adjusted p-value will be compared with |
pAdjMethod |
if |
cutoff |
if p value is smaller than the cutoff, there will be an edge between the two nodes. |
nPseudo |
if |
A list with 6 elements:
my_graph |
obtained network as igraph object |
my_dat |
obtained netork as data frame with 3 columns: edge id, node_id1,node_id2 |
pvalMat |
raw p-values for testing differential correlation for each pair of genes |
pAdjMat |
adjusted p-values for testing differential correlation for each pair of genes |
pvalPseudo |
p-values for testing differential correlation between pseudo genes and other genes |
alpha1 |
cutoff for p-values for testing differential correlation |
Danyang Yu <[email protected]>, Weiliang Qiu <[email protected]>
Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)
set.seed(1234567) res = generate_data(n1 = 50, n2 = 60, p1 = 5, p2 = 50) es = res$es print(es) covCtrl = res$covCtrl covCase = res$covCase # we expect cov for 1st 5 genes are different between cases and controls print(round(covCtrl[1:5, 1:5], 2)) print(round(covCase[1:5, 1:5], 2)) # we expect cov for other genes are same between cases and controls print(round(covCtrl[6:10, 6:10], 2)) print(round(covCase[6:10, 6:10], 2)) res2 = construct_network(es = es, cor_method = "st5", pseudo_adjust_cutoff = FALSE, var.grp = "grp", pAdjMethod = 'fdr', cutoff = 0.05, nPseudo = 25) print(res2$graph) print(res2$network_dat)
set.seed(1234567) res = generate_data(n1 = 50, n2 = 60, p1 = 5, p2 = 50) es = res$es print(es) covCtrl = res$covCtrl covCase = res$covCase # we expect cov for 1st 5 genes are different between cases and controls print(round(covCtrl[1:5, 1:5], 2)) print(round(covCase[1:5, 1:5], 2)) # we expect cov for other genes are same between cases and controls print(round(covCtrl[6:10, 6:10], 2)) print(round(covCase[6:10, 6:10], 2)) res2 = construct_network(es = es, cor_method = "st5", pseudo_adjust_cutoff = FALSE, var.grp = "grp", pAdjMethod = 'fdr', cutoff = 0.05, nPseudo = 25) print(res2$graph) print(res2$network_dat)
A BioConductor ExpressionSet object storing gene expression data.
data("es")
data("es")
The expression data are stored in a matrix, which contains 55 row genes and 110 column subjects.
The phenotye data contains two variables: sid
(subject ID)
and grp
(case-control status). grp=1
indicates the subject
is a case. grp=0
indicates the subject is a control.
The feature data contains two variables: geneid
(gene ID) and memGenes
. memGenes=1
indicates the gene is differentially correlated between cases and controls with
at least one other gene. memGenes=0
indicates the gene is not diffferentially correlated with other genes.
The data contains 50 cases and 60 controls. The first 5 genes are differentially correlated with at least one other genes, while the remaining 50 genes are non-differentially correlated with other genes.
The covariance matrix of the first 5 genes in cases were generated by the function rcorrmatrix
in R package clusterGeneration
. The covariance matrix of the first 5 genes in controls are identical matrix.
The covariance matrix of the remaining 50 genes in cases
were generated by the function rcorrmatrix
. The covariance matrix of the 50 genes in controls were the same as that in cases.
The first 50 subjects are cases. The remaining 60 subjects are controls.
Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)
data(es) print(es)
data(es) print(es)
Compute p-value with Fisher’s Z-transformation test. If biasCorrection is true, the corrected correlation is used. The formula is rho.corrected = rho - rho/(2*(n-1)).
fisher_transfer_test(x1, z1, x0, z0, biasCorrection = TRUE)
fisher_transfer_test(x1, z1, x0, z0, biasCorrection = TRUE)
x1 |
a numeric vector |
z1 |
a numeric vector with same length as |
x0 |
a numeric vector |
z0 |
a numeric vector with same length as |
biasCorrection |
a boolean value |
p-value of test for testing if correlation between x1
and z1
is the same as that between x0
and z0
Danyang Yu <[email protected]>, Weiliang Qiu <[email protected]>
Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = fisher_transfer_test(x1, z1, x0, z0) print(p)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = fisher_transfer_test(x1, z1, x0, z0) print(p)
The function is to generate expression level matrixes of control subjects and case subjects. X matrix is for control subjects with the default sample size n1=50. Z matrix is for case subjects with the default sample size n2=60. X is generated from multivariate normal distribution N (0, SigmaX), where SigmaX is a block matrix ((SigmaP1, 0), (0, SigmaP2)), sigmaP1 is the p1*p1 matrix and SigmaP2 is the p2*p2 matrix. Z is generated from multivariate normal distribution N (0, SigmaZ), where SigmaZ is a block matrix ((E_P1, 0), (0, SigmaP2)) and E_P1 is p1*p1 identity matrix.
generate_data(n1, n2, p1, p2)
generate_data(n1, n2, p1, p2)
n1 |
a numeric value representing the sample size of control subjects |
n2 |
a numeric value representing the sample size of case subjects |
p1 |
a numeric value representing the dimension of sigma_1 |
p2 |
a numeric value representing the dimension of sigma_0 |
A list with 3 elements:
es |
An ExpressionSet object contains gene expression data. |
covCase |
Covariance matrix of all genes for case subjects. |
covCtrl |
Covariance matrix of all genes for control subjects. |
Danyang Yu <[email protected]>, Weiliang Qiu <[email protected]>
Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)
library(Biobase) set.seed(1234567) res = generate_data(n1 = 50, n2 = 60, p1 = 5, p2 = 50) es = res$es print(es) # gene expression data dat = exprs(es) print(dim(dat)) print(dat[1:2,1:3]) # phenotype data pDat = pData(es) print(dim(pDat)) print(pDat[1:2,]) print(table(pDat$grp, useNA = "ifany")) # feature data fDat = fData(es) print(dim(fDat)) print(fDat[1:2,]) print(table(fDat$memGenes, useNA = "ifany")) covCtrl = res$covCtrl covCase = res$covCase # we expect cov for 1st 5 genes are different between cases and controls print(round(covCtrl[1:5, 1:5], 2)) print(round(covCase[1:5, 1:5], 2)) # we expect cov for other genes are same between cases and controls print(round(covCtrl[6:10, 6:10], 2)) print(round(covCase[6:10, 6:10], 2))
library(Biobase) set.seed(1234567) res = generate_data(n1 = 50, n2 = 60, p1 = 5, p2 = 50) es = res$es print(es) # gene expression data dat = exprs(es) print(dim(dat)) print(dat[1:2,1:3]) # phenotype data pDat = pData(es) print(dim(pDat)) print(pDat[1:2,]) print(table(pDat$grp, useNA = "ifany")) # feature data fDat = fData(es) print(dim(fDat)) print(fDat[1:2,]) print(table(fDat$memGenes, useNA = "ifany")) covCtrl = res$covCtrl covCase = res$covCase # we expect cov for 1st 5 genes are different between cases and controls print(round(covCtrl[1:5, 1:5], 2)) print(round(covCase[1:5, 1:5], 2)) # we expect cov for other genes are same between cases and controls print(round(covCtrl[6:10, 6:10], 2)) print(round(covCase[6:10, 6:10], 2))
Generate an ExpressionSet object.
genEset(ex, pDat, fDat = NULL, annotation = "")
genEset(ex, pDat, fDat = NULL, annotation = "")
ex |
a data matrix stores gene expression data. Rows are genes and columns are subjects. |
pDat |
a data frame stores phenotype data. Rows are subjects and columns are variables describing subjects. Row names of |
fDat |
a data frame stores feature data. Rows are genes and columns are variables describing genes. Row names of |
annotation |
character. indicates R Bioconductor annotation package that provides annotation for genes. |
A BioConductor ExpressionSet object.
Danyang Yu <[email protected]>, Weiliang Qiu <[email protected]>
generating varibles from g-and-h distribution
ghdist(n, g = 0,h = 0)
ghdist(n, g = 0,h = 0)
n |
the number of the varibles you want to generate |
g |
the parameter g of g-and-h distribution |
h |
the parameter h of g-and-h distribution |
n varibles generated from g-and-h distribution
x = ghdist(50, 0.2, 0.2) print(x)
x = ghdist(50, 0.2, 0.2) print(x)
Scatter plot of 2 genes for cases and controls, superimposed with linear regression lines.
plotDiffCor(x1, z1, x0, z0, pval = NULL, xlab = "gene1", ylab = "gene2", title = "scatter plots")
plotDiffCor(x1, z1, x0, z0, pval = NULL, xlab = "gene1", ylab = "gene2", title = "scatter plots")
x1 |
numeric. vector of gene expression for gene 1 for cases. |
z1 |
numeric. vector of gene expression for gene 2 for cases. |
x0 |
numeric. vector of gene expression for gene 1 for controls. |
z0 |
numeric. vector of gene expression for gene 2 for controls. |
pval |
numeric. p-value for testing differential correlation of the 2 genes between cases and controls. |
xlab |
character. label for x-axis. |
ylab |
character. label for y-axis. |
title |
character. plot title. |
A list with 4 elments:
g |
A ggplot2 object. |
dat |
a data frame with 3 variables: x, z, and grp. |
coef1 |
a vector of length two giving the intercept and slope of linear regression for cases. |
coef0 |
a vector of length two giving the intercept and slope of linear regression for controls. |
Danyang Yu <[email protected]>, Weiliang Qiu <[email protected]>
Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)
library(Biobase) set.seed(1234567) res = generate_data(n1 = 50, n2 = 60, p1 = 5, p2 = 50) es = res$es print(es) # gene expression data dat = exprs(es) print(dim(dat)) print(dat[1:2,1:3]) # 3rd gene x = dat[3,] # 5th gene z = dat[5,] # for cases x1 = x[which(es$grp == 1)] z1 = z[which(es$grp == 1)] # for controls x0 = x[which(es$grp == 0)] z0 = z[which(es$grp == 0)] # st5 res2 = st5(x1 = x1, z1 = z1, x0 = x0, z0 = z0) pval = res2$pval plotDiffCor(x1 = x1, z1 = z1, x0 = x0, z0 = z0, pval = pval, xlab = "gene3", ylab = "gene5", title = "scatter plots" )
library(Biobase) set.seed(1234567) res = generate_data(n1 = 50, n2 = 60, p1 = 5, p2 = 50) es = res$es print(es) # gene expression data dat = exprs(es) print(dim(dat)) print(dat[1:2,1:3]) # 3rd gene x = dat[3,] # 5th gene z = dat[5,] # for cases x1 = x[which(es$grp == 1)] z1 = z[which(es$grp == 1)] # for controls x0 = x[which(es$grp == 0)] z0 = z[which(es$grp == 0)] # st5 res2 = st5(x1 = x1, z1 = z1, x0 = x0, z0 = z0) pval = res2$pval plotDiffCor(x1 = x1, z1 = z1, x0 = x0, z0 = z0, pval = pval, xlab = "gene3", ylab = "gene5", title = "scatter plots" )
Compute p-value for the equal correlation test with Pearson correlation based on a logistic regression model corresponding to two independent groups
st1(x1, z1, x0, z0)
st1(x1, z1, x0, z0)
x1 |
a numeric vector |
z1 |
a numeric vector with same length as |
x0 |
a numeric vector |
z0 |
a numeric vector with same length as |
stat |
Test statistic for testing if correlation between |
p-value |
p-value of test |
signedStat |
Signed test statistic |
Danyang Yu <[email protected]>, Weiliang Qiu <[email protected]>
Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = st1(x1, z1, x0, z0) print(p)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = st1(x1, z1, x0, z0) print(p)
Compute p-value for the equal correlation test with mad-replacing-Pearson correlation based on a logistic regression model corresponding to two independent groups
st2(x1, z1, x0, z0)
st2(x1, z1, x0, z0)
x1 |
a numeric vector |
z1 |
a numeric vector with same length as |
x0 |
a numeric vector |
z0 |
a numeric vector with same length as |
stat |
Test statistic for testing if correlation between |
p-value |
p-value of test |
signedStat |
Signed test statistic |
Danyang Yu <[email protected]>, Weiliang Qiu <[email protected]>
Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = st2(x1, z1, x0, z0) print(p)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = st2(x1, z1, x0, z0) print(p)
Compute p-value for the equal correlation test with percentage bend correlation based on a logistic regression model corresponding to two independent groups
st3(x1, z1, x0, z0)
st3(x1, z1, x0, z0)
x1 |
a numeric vector |
z1 |
a numeric vector with same length as |
x0 |
a numeric vector |
z0 |
a numeric vector with same length as |
stat |
Test statistic for testing if correlation between |
p-value |
p-value of test |
signedStat |
Signed test statistic |
Danyang Yu <[email protected]>, Weiliang Qiu <[email protected]>
Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = st3(x1, z1, x0, z0) print(p)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = st3(x1, z1, x0, z0) print(p)
Compute p-value for the equal correlation test with Spearman corrleaion based on a logistic regression model corresponding to two independent groups
st4(x1, z1, x0, z0)
st4(x1, z1, x0, z0)
x1 |
a numeric vector |
z1 |
a numeric vector with same length as |
x0 |
a numeric vector |
z0 |
a numeric vector with same length as |
stat |
Test statistic for testing if correlation between |
p-value |
p-value of test |
signedStat |
Signed test statistic |
Danyang Yu <[email protected]>, Weiliang Qiu <[email protected]>
Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = st4(x1, z1, x0, z0) print(p)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = st4(x1, z1, x0, z0) print(p)
# Compute p-value for the equal correlation test with combination of Spearman corrleaion and percentage bend correlation based on a logistic regression model corresponding to two independent groups
st5(x1, z1, x0, z0)
st5(x1, z1, x0, z0)
x1 |
a numeric vector |
z1 |
a numeric vector with same length as |
x0 |
a numeric vector |
z0 |
a numeric vector with same length as |
stat |
Test statistic for testing if correlation between |
p-value |
p-value of test |
signedStat |
Signed test statistic |
Danyang Yu <[email protected]>, Weiliang Qiu <[email protected]>
Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = st5(x1, z1, x0, z0) print(p)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) p = st5(x1, z1, x0, z0) print(p)
Compute p-value for the equal correlation test with another way to combine Spearman corrleaion and percentage bend correlation based on a multiple logistic regression model corresponding to two independent groups
st6(x1, z1, x0, z0)
st6(x1, z1, x0, z0)
x1 |
a numeric vector |
z1 |
a numeric vector with same length as |
x0 |
a numeric vector |
z0 |
a numeric vector with same length as |
A list with 3 elements:
u |
the vector of Fisher score. |
pval |
p-value of test for testing if correlation between |
cov_u |
covariance matrix for |
Danyang Yu <[email protected]>, Weiliang Qiu <[email protected]>
Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) res = st6(x1, z1, x0, z0) print(res)
x1 = ghdist(n = 100, g = 0.2, h = 0.2) x0 = ghdist(n = 100, g = 0.2, h = 0.2) z1 = x1 + ghdist(n = 100, g = 0.2, h = 0.2) z0 = x0 + ghdist(n = 100, g = 0.2, h = 0.2) res = st6(x1, z1, x0, z0) print(res)