simulate_sbm_plus_srm_network_with_measurement_bias: A function to simulate single layer directed networks using a...

View source: R/simulate_sbm_plus_srm_network_with_measurement_error.R

simulate_sbm_plus_srm_network_with_measurement_biasR Documentation

A function to simulate single layer directed networks using a combined stochastic block and social relations model

Description

This is a function to simulate single layer 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.

Usage

simulate_sbm_plus_srm_network_with_measurement_bias(
  N_id = 30,
  B = NULL,
  V = 3,
  groups = NULL,
  sr_mu = c(0, 0),
  sr_sigma = c(0.3, 1.5),
  sr_rho = 0.6,
  dr_mu = c(0, 0),
  dr_sigma = 1,
  dr_rho = 0.7,
  exposure_mu = 1.9,
  exposure_sigma = 0.01,
  exposure_max = 50,
  censoring_mu = 1.9,
  censoring_sigma = 0.01,
  N_trials = 20,
  mode = "binomial",
  individual_predictors = NULL,
  dyadic_predictors = NULL,
  exposure_predictors = NULL,
  censoring_predictors = NULL,
  individual_effects = NULL,
  dyadic_effects = NULL,
  exposure_effects = NULL,
  censoring_effects = NULL
)

Arguments

N_id

Number of individuals.

B

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.

V

Number of blocking variables in B.

groups

Dataframe of the block IDs of each individual for each variable in B.

sr_mu

Mean vector for sender and receivier random effects. In most cases, this should be c(0,0).

sr_sigma

A standard deviation vector for sender and receivier random effects. The first element controls node-level variation in out-degree, the second in in-degree.

sr_rho

Correlation of sender-receiver effects (i.e., generalized reciprocity).

dr_mu

Mean vector for dyadic random effects. In most cases, this should be c(0,0).

dr_sigma

Standard deviation for dyadic random effects.

dr_rho

Correlation of dyad effects (i.e., dyadic reciprocity).

exposure_mu

Intercept term for log-odds of encounter.

exposure_sigma

Standard deviation for exposure random effects.

exposure_max

Max sample size of observations for a given focal.

censoring_mu

Intercept term for log-odds of censoring.

censoring_sigma

Standard deviation for censoring random effects.

N_trials

Number of binomial trials in follow-up detectability experiment.

mode

Outcome mode: only "binomial" is supported.

individual_predictors

An N_id by N_individual_parameters matrix of covariates.

dyadic_predictors

An N_id by N_id by N_dyadic_parameters array of covariates.

exposure_predictors

An N_id by N_individual_parameters matrix of covariates.

censoring_predictors

An N_id by N_individual_parameters matrix of covariates.

individual_effects

A 2 by N_individual_parameters matrix of slopes. The first row gives effects of focal characteristics (on out-degree). The second row gives effects of target characteristics (on in-degree).

dyadic_effects

An N_dyadic_parameters vector of slopes.

exposure_effects

An N_parameters vector of slopes.

censoring_effects

An N_parameters vector of slopes.

Value

A list of objects including: network (an adjacency matrix of binary outcomes), tie_strength (an adjacency matrix 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).


ctross/STRAND documentation built on Nov. 14, 2024, 11:50 p.m.