netCor: Calculate the correlation between two networks

View source: R/netCor.R

netCorR Documentation

Calculate the correlation between two networks

Description

This function computes Mantel's permutation test for similarity of two matrices. It permutes the rows and columns of the second matrix randomly and calculates a Z-statistic.

Usage

netCor(x1, x2, nperm = 1000, graph = TRUE, alternative = "two.sided", ...)

Arguments

x1

the first network, should be the product of quickNet::quickNet(), or an adjacency matrix of network data.

x2

the second network, should be the product of quickNet::quickNet(), or an adjacency matrix of network data.

nperm

the number of times to permute the data.

graph

a logical indicating whether to produce a summary graph.

alternative

a character string defining the alternative hypothesis: "two.sided" (default), "less", "greater", or any unambiguous abbreviation of these.

...

further arguments to be passed to plot() (to add a title, change the axis labels, and so on).

Details

The function calculates a Z-statistic for the Mantel test, equal to the sum of the pairwise product of the lower triangles of the permuted matrices, for each permutation of rows and columns. It compares the permuted distribution with the Z-statistic observed for the actual data.

Value

  • z.stat: the Z-statistic (sum of rows*columns of lower triangle) of the data matrices.

  • p: P-value (quantile of the observed Z-statistic in the permutation distribution).

  • alternative: the alternative hypothesis.

Examples

data('mtcars')
net1 <- quickNet(mtcars)
net2 <- quickNet(mtcars^3)
netCor(net1, net2)


LeiGuo0812/quickNet documentation built on May 1, 2024, 10:42 p.m.