View source: R/simulate_longitudinal_network.R
simulate_longitudinal_network | R Documentation |
This is a function to simulate multilayer longitudinal network data with a stochastic block structure, sender-receiver effects, and dyadic reciprocity. This function is essentially the union of a social relations model and a stochastic block model.
simulate_longitudinal_network(
N_id = 99,
N_timesteps = 3,
B = NULL,
V = 3,
groups = NULL,
sr_mu = c(0, 0),
sr_sigma,
sr_Rho,
dr_mu = 0,
dr_sigma,
dr_Rho,
outcome_mode = "bernoulli",
link_mode = "logit",
individual_predictors = NULL,
dyadic_predictors = NULL,
individual_effects = NULL,
dyadic_effects = NULL
)
N_id |
Number of individuals. |
N_timesteps |
Number of network layers, one per timestep. |
B |
List of List of matrices that hold intercept and offset terms. Log-odds. The first matrix should be 1 x 1 with the value being the intercept term. The first list is over layers/time-steps. The second is over block variables within layers. |
V |
Number of blocking variables in each layer. |
groups |
A list of dataframes of the block IDs of each individual for each variable in B. |
sr_mu |
A vector for sender and receivier random effects. In most cases, this should be a vector of 0s 2*N_timesteps long. |
sr_sigma |
A standard deviation vector for sender and receivier random effects. The first N_timesteps elements control node-level variation in out-degree, the second N_timesteps elements control in-degree. |
sr_Rho |
Correlation of sender-receiver effects (i.e., generalized reciprocity). Needs to be a valid correlation matrix, 2*N_timesteps by 2*N_timesteps. |
dr_mu |
A vector for dyadic random effects. In most cases, this should be a vector of 0s N_timesteps long. |
dr_sigma |
Standard deviation for dyadic random effects. This should be a vector N_timesteps long. |
dr_Rho |
Correlation of dyad effects (i.e., dyadic reciprocity). Needs to be a valid correlation matrix, 2*N_timesteps by 2*N_timesteps. |
outcome_mode |
Outcome mode: can be "bernoulli", "poisson", or "binomial". |
link_mode |
Link mode: can be "logit", "probit", or "log". For pois, you must use log. |
individual_predictors |
An N_timesteps list of N_id x N_individual_parameters array of covariates. |
dyadic_predictors |
An N_timesteps list of N_id x N_id x N_dyadic_parameters array of covariates. |
individual_effects |
A list of 2 by N_individual_parameters matrix of slopes. The list runs over layers/timesteps. In each element, the first row gives effects of focal characteristics (on out-degree). The second row gives effects of target characteristics (on in-degree). |
dyadic_effects |
A list of N_dyadic_parameters vectors of slopes. |
A list of objects including: network (an adjacency tensor of binary outcomes), tie_strength (an adjacency tensor with probability weights), group_ids (a vector of length N_id, giving the group of each individual), individual_predictors (the supplied covariate data is saved along with the network data), and dyadic_predictors (the supplied covariate data is saved along with the network data).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.