sim_A | R Documentation |
Simulate an unweighted or weighted network, with or without noise edges, from a D
-dimensional latent space cluster model with K
clusters and N
actors. The squared euclidean distance is used (i.e., dist(U_i,U_j)^2
), where U_i
and U_j
are the respective actor's positions in a D
-dimensional social space.
sim_A(
N,
mus,
omegas,
p,
model = "NDH",
family = "bernoulli",
params_LR,
params_weights = NULL,
noise_weights_prob = 0,
mean_noise_weights,
precision_noise_weights,
remove_isolates = TRUE
)
N |
An integer specifying the number of actors in the network. |
mus |
A numeric |
omegas |
A numeric |
p |
A numeric vector of length |
model |
A character string specifying the type of model used to simulate the network:
|
family |
A character string specifying the distribution of the edge weights.
|
params_LR |
A list containing the parameters of the logistic regression model to simulate the unweighted network, including:
|
params_weights |
Only relevant when
|
noise_weights_prob |
A numeric in [0,1] representing the proportion of all edges in the simulated network that are noise edges (default is 0.0). |
mean_noise_weights |
A numeric representing the mean of the noise weight distribution. Only relevant when |
precision_noise_weights |
A positive, non-zero, numeric representing the precision (on the log scale) of the log-normal noise weight distribution. Only relevant when |
remove_isolates |
A logical; if |
The returned scalar q_prob
represents the proportion of non-edges in the simulated network to be converted to noise edges, computed as \frac{p_{noise} \times D_{A}}{(1-D_{A}) \times (1-p_{noise})}
, where D_{A}
is the density of the simulated network without noise and p_{noise}
is the inputted noise_weights_prob
.
A list containing the following components:
A |
A sparse adjacency matrix of class 'dgCMatrix' representing the "true" underlying unweighted network with no noise edges. |
W |
A sparse adjacency matrix of class 'dgCMatrix' representing the unweighted or weighted network, with or without noise. Note, if |
q_prob |
A numeric scalar representing the proportion of non-edges in the "true" underlying network converted to noise edges. See 'Details' for how this value is computed. |
Z_U |
A numeric |
Z_W |
A numeric |
U |
A numeric |
mus |
The inputted numeric |
omegas |
The inputted numeric |
p |
The inputted numeric vector |
noise_weights_prob |
The inputted numeric scalar |
mean_noise_weights |
The inputted numeric scalar |
precision_noise_weights |
The inputted numeric scalar |
model |
The inputted |
family |
The inputted |
params_LR |
The inputted |
params_weights |
The inputted |
mus <- matrix(c(-1,-1,1,-1,1,1),
nrow = 3,
ncol = 2,
byrow = TRUE)
omegas <- array(c(diag(rep(7,2)),
diag(rep(7,2)),
diag(rep(7,2))),
dim = c(2,2,3))
p <- rep(1/3, 3)
beta0 <- 1.0
# Simulate an undirected, unweighted network, with no noise and no degree heterogeneity
JANE::sim_A(N = 100L,
model = "NDH",
mus = mus,
omegas = omegas,
p = p,
params_LR = list(beta0 = beta0),
remove_isolates = TRUE)
# Simulate a directed, weighted network, with degree and strength heterogeneity but no noise
JANE::sim_A(N = 100L,
model = "RSR",
family = "lognormal",
mus = mus,
omegas = omegas,
p = p,
params_LR = list(beta0 = beta0),
params_weights = list(beta0 = 2,
precision_weights = 1),
remove_isolates = TRUE)
# Simulate an undirected, weighted network, with noise and degree and strength heterogeneity
JANE::sim_A(N = 100L,
model = "RS",
family = "poisson",
mus = mus,
omegas = omegas,
p = p,
params_LR = list(beta0 = beta0),
params_weights = list(beta0 = 2),
noise_weights_prob = 0.1,
mean_noise_weights = 1,
remove_isolates = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.