ModelDiffNet

Contents

ModelDiffNet#

class epiworldpy.epimodels.ModelDiffNet(self: epiworldpy._core.epimodels.ModelDiffNet, name: str, prevalence: SupportsFloat | SupportsIndex, prob_adopt: SupportsFloat | SupportsIndex, normalize_exposure: bool, data: SupportsFloat | SupportsIndex, data_ncols: SupportsInt | SupportsIndex, data_cols: collections.abc.Sequence[SupportsInt | SupportsIndex], params: collections.abc.Sequence[SupportsFloat | SupportsIndex])#

Bases: Model

Network diffusion model: adoption of a behavior spread through a network.

Unlike an epidemic model, the probability that an agent adopts depends on how many of its neighbors have adopted (its exposure), not on transmission from a single neighbor:

P(adopt) = logit^-1(prob_adopt + params * data + exposure)

States: Non adopters, Adopters.

The model has no agents until a population is added, for example with agents_smallworld().

Create a network diffusion model.

Parameters:
  • name (str) – Name of the behavior (innovation).

  • prevalence (float) – Initial proportion of adopters.

  • prob_adopt (float) – Baseline probability of adoption.

  • normalize_exposure (bool) – Whether to divide the exposure by the number of neighbors.

  • data (float) – Agent covariates. Not supported from Python yet: the model keeps a pointer to this value, which does not outlive the call. Pass 0.0 with data_ncols=0.

  • data_ncols (int) – Number of covariate columns in data.

  • data_cols (list of int) – Indices of the covariates used in the adoption probability.

  • params (list of float) – Coefficient of each covariate in data_cols.