CorrelationParameters.Rd
Class: Correlation parameters
Class: Correlation parameters
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.
new()
initialise correlation parameters
CorrelationParameters$new(population, interventions)
sigma()
Standard deviation of each intervention between rounds
restore_state()
Restore the correlation state.
Only the randomly drawn weights are restored. The object needs to be initialized with the same rhos.