Learn R Programming

GraphAlignment (version 1.36.0)

GenerateExample: Generate example input data

Description

Generate input data which can be used as an example.

Usage

GenerateExample(dimA, dimB, filling, covariance, symmetric = FALSE, numOrths = 0, correlated = NA, distribution = "normal")

Arguments

dimA
size of network A
dimB
size of network B
filling
fraction of entries which are not explicitly set to zero
covariance
covariance of correlated rows and columns
symmetric
generate symmetric matrices
numOrths
number of diagonal elements to set to 1 in example matrix R
correlated
indices of correlated rows and columns
distribution
from which distribution are the values drawn ("normal" or "uniform")

Value

The return value is a list containing example matrices A (a), B (b) and R (r).

Details

Symmetric example matrices A, B can be generated by specifying TRUE as the 'symmetric' argument. If the 'numOrths' argument is specified, a number of diagonal elements of R equal to the value will be set to 1. If a vector is specified as the 'correlated' argument, the specified rows and columns will be set to correlated values. Leaving this argument blank will result in pairwise correlations of all entries in A, B (or, if the matrices are of different rank, all elements of the smaller on will be correlated with the corresponding parts of the larger matrix).

Examples

Run this code
ex <- GenerateExample(dimA = 170, dimB = 140, filling = 0.75,
                      covariance = 0.4, symmetric = TRUE, numOrths = 90,
                      correlated = 1:90, distribution = "normal")

##-- edge weight correlation
image(cor(ex$a[1:140, 1:140], ex$b))
hist(diag(cor(ex$a[1:140, 1:140], ex$b))[1:90])

##-- edge weight distribution
hist(ex$a[ex$a != 0]);
hist(ex$b[ex$b != 0]);

Run the code above in your browser using DataLab