Methods for Specifying, Simulating from, and Fitting Marginal Causal Models
This package enables one to simulate from a frugal parameterization, that is one where we have a specific marginal causal quantity of interest and use something like a copula to model its dependence structure. More details can be found in Evans and Didelez (2024).
graph TD
A(Z) --> B(X)
B --> C(Y)
A --> C
Suppose we have the causal model above, and are interested in a
marginal structural model (MSM):
One example would consist of setting
We can specify such a marginal causal model with the following syntax.
# formulae corresponding to covariates, treatments, outcomes and the dependence
forms <- list(Z ~ 1, X ~ Z, Y ~ X, ~ 1)
# vector of model families (3=gamma/exponential, 1=normal/Gaussian)
fam <- c(3, 1, 1, 1)
# list of parameters, including 'beta' (regression params) and 'phi' dispersion
pars <- list(Z = list(beta=log(1), phi=1), # note log-link
X = list(beta=c(0,0.5), phi=1),
Y = list(beta=c(-0.5,0.5), phi=1),
cop = list(beta=1))
## now create a `causl_model` object
cm <- causl_model(formulas=forms, family=fam, pars=pars)
# now simulate 100 observations
rfrugal(n=100, causl_model=cm)
Note that, by default, we use the log link for the Gamma distribution.
Evans, R.J. and Didelez, V. Parameterizing and simulating from causal models (with discussion). Journal of the Royal Statistical Society, Series B (to appear), 2024.