Class: Correlation parameters

Class: Correlation parameters

Details

This class implements functionality that allows interventions to be correlated, positively or negatively. By default, interventions are applied independently and an individual's probability of receiving two interventions (either two separate interventions or two rounds of the same one) is the product of the probability of receiving each one.

By setting a positive correlation between two interventions, we can make it so that the individuals that receive intervention A are more likely to receive intervention B. Conversely, a negative correlation will make it such that individuals that receive intervention A are less likely to also receive intervention B.

Broadly speaking, the implementation works by assigning at startup a weight to each individual and intervention pair, reflecting how likely an individual is to receive that intervention. Those weights are derived stochastically from the configured correlation parameters.

For a detailed breakdown of the calculations, see Protocol S2 of Griffin et al. (2010). Derive the mvnorm from the configured correlations.

If a restored_mvnorm is specified, its columns (corresponding to restored interventions) will be re-used as is. Missing columns (for new interventions) are derived in accordance with the restored data.

Methods


Method new()

initialise correlation parameters

Usage

CorrelationParameters$new(population, interventions)

Arguments

population

popularion size

interventions

character vector with the name of enabled interventions


Method inter_round_rho()

Add rho between rounds

Usage

CorrelationParameters$inter_round_rho(int, rho)

Arguments

int

string representing the intervention to update

rho

value between 0 and 1 representing the correlation between rounds of the intervention


Method inter_intervention_rho()

Add rho between interventions

Usage

CorrelationParameters$inter_intervention_rho(int_1, int_2, rho)

Arguments

int_1

string representing the first intervention

int_2

string representing the second intervention (intechangable with int_1)

rho

value between -1 and 1 representing the correlation between rounds of the intervention


Method sigma()

Standard deviation of each intervention between rounds

Usage

CorrelationParameters$sigma()


Method mvnorm()

multivariate norm draws for these parameters

Usage

CorrelationParameters$mvnorm()


Method save_state()

Save the correlation state.

Usage

CorrelationParameters$save_state()


Method restore_state()

Restore the correlation state.

Only the randomly drawn weights are restored. The object needs to be initialized with the same rhos.

Usage

CorrelationParameters$restore_state(timestep, state)

Arguments

timestep

the timestep at which simulation is resumed. This parameter's value is ignored, it only exists to conform to a uniform interface.

state

a previously saved correlation state, as returned by the save_state method.


Method clone()

The objects of this class are cloneable with this method.

Usage

CorrelationParameters$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.