mossspider.dgm.generate_observed¶
- generate_observed(graph, seed=None)¶
Simulates the exposure and outcome for the uniform random graph (following mechanisms are from Sofrygin & van der Laan 2017).
\[\begin{split}A = \text{Bernoulli}(\text{expit}(-1.2 + 1.5 W + 0.6 W^s)) \\ Y = \text{Bernoulli}(\text{expit}(-2.5 + 0.5 A + 1.5 A^s + 1.5 W + 1.5 W^s))\end{split}\]- Parameters
graph (Graph) – Graph generated by the uniform_network function.
seed (int, None, optional) – Random seed to use. Default is None.
- Returns
- Return type
Network object with node attributes
Examples
Loading the necessary functions
>>> from mossspider.dgm import uniform_network, generate_observed
Generating the uniform network
>>> G = uniform_network(n=500, degree=[0, 2])
Generating exposure A and outcome Y for network
>>> H = generate_observed(graph=G)
References
Sofrygin O, & van der Laan MJ. (2017). Semi-parametric estimation and inference for the mean outcome of the single time-point intervention in a causally connected population. Journal of Causal Inference, 5(1).