Learn R Programming

multiness (version 1.0.2)

multiness_sim: Simulate from the MultiNeSS model

Description

multiness_sim simulates a realization of the Gaussian or logistic MultiNeSS model with Gaussian latent positions.

Usage

multiness_sim(n,m,d1,d2,model,sigma,self_loops,opts)

Value

A list is returned with the realizations of the latent dimensions and the multiplex network:

A

An array of dimension \(n \times n \times m\), the realized multiplex network.

V

A matrix of dimension \(n \times d1\), the realized common latent positions. If d1=0, returns NULL.

U

An array of dimension \(n \times d2 \times m\), the realized individual latent positions. If d2=0, returns NULL.

P

If specified, an array of dimension \(n \times n \times m\), the expected multiplex network.

density

If specified and model='logistic', the overall edge density.

Arguments

n

A positive integer, the number of nodes.

m

A positive integer, the number of layers.

d1

A non-negative integer, the number of common latent dimensions.

d2

A non-negative integer, the number of individual latent dimensions.

model

A string which provides choice of model, either 'gaussian' or 'logistic'. Defaults to 'gaussian'.

sigma

A positive scalar or numeric vector of length m, the entry-wise standard deviation for the Gaussian noise for all layers (if a scalar) or for each layer (if a vector). Ignored under the logistic model. Defaults to 1.

self_loops

A Boolean, if FALSE, all diagonal entries are set to zero. Defaults to TRUE.

opts

A list, containing additional optional arguments:

density_shift

A positive scalar, for the logistic model only, a shift subtracted from the log-odds of each edge to control overall edge density. Defaults to 0.

dependence_type

A string, valid choices are 'all' or 'U_only' for the Gaussian model; 'all' for the logistic model. If 'all', \(V\) and \(U_k\); and \(U_k\) and \(U_l\) (for \(k \neq l\)) have expected canonical correlation approximately equal to |\(rho\)| (see rho). If 'U_only', \(U_k\) and \(U_l\) (for \(k \neq l\)) have expected canonical correlation approximately equal to |\(rho\)| (see rho). Defaults to 'all'.

gamma

A positive scalar, the standard deviation of the entries of the latent position matrices \(V\) and \(U_k\). Defaults to 1.

return_density

A Boolean, if TRUE and model='logistic', the function will return an array containing the overall edge density. Defaults to FALSE.

return_P

A Boolean, if TRUE, the function will return an array containing the expected adjacency matrices. Defaults to FALSE.

rho

A positive scalar in the interval (-1,1), controls the expected canonical correlation between latent position matrices (see dependence_type). Defaults to 0.

Details

The common and individual latent positions, \(V\) and \(U_k\) respectively, are generated as Gaussian random variables with standard deviation opts$gamma, and dependence controlled by the optional arguments opts$dependence_type and opts$rho.

Under the Gaussian model, the \(n \times n\) adjacency matrix for layer \(k=1,...,m\) has independent Gaussian entries with standard deviation sigma and mean given by $$E(A_k) = VV^{T} + U_kU_k^{T}.$$

Under the logistic model, the \(n \times n\) adjacency matrix for layer \(k=1,...,m\) has independent Bernoulli entries with mean given by $$E(A_k) = g(VV^{T} + U_kU_k^{T}),$$ where \(g\) denotes the element-wise application of the inverse logistic link (expit) function. Under both models, self_loops provides an option to set the diagonal entries of the adjacency matrices to zero.

Examples

Run this code
# gaussian model, uncorrelated latent positions
data1 <- multiness_sim(n=100,m=4,d1=2,d2=2,
                      model="gaussian")

# logistic model, correlated latent positions
data2 <- multiness_sim(n=100,m=4,d1=2,d2=2,
                       model="logistic",
                       self_loops=FALSE,
                       opts=list(dependence_type="all",rho=.3,return_density=TRUE))

Run the code above in your browser using DataLab