| msm | R Documentation |
Estimation of a marginal structural model using results from the parametric g-formula.
msm(X, formula, family = gaussian, se = NULL, cilevel = 0.95, abar=NULL)
X |
An object of class |
formula |
Form of the marginal structural model. Can be specified as a formula object, e.g., |
family |
A description of the error distribution and link function to be used in the model. See |
se |
A character string specifying the standard errors used to compute confidence intervals. One of |
cilevel |
Numeric value between 0 and 1 specifying the confidence level of the bootstrap confidence intervals. Defaults to 95%. |
abar |
Vector or matrix that is a subset of the intervention used in X. Can be used to fit an MSM on a subset of the stacked counterfactual data. |
The marginal structural model (MSM) is estimated as a GLM. Confidence intervals are calculated using GLM standard errors (if se = 'glm') or nonparametric boostrap standard errors (if se = 'bootstrap' and gformula was run with B > 0.) By default: se = 'bootstrap' if gformula was run with B > 0, and se = 'glm' otherwise.
Returns a list of class msmResult:
MSM |
The fitted MSM of class |
coefs |
The estimated coefficients of the MSM. |
CIlow |
Lower confidence interval bounds for each coefficient. |
CIup |
Upper confidence interval bounds for each coefficient. |
formula |
The 'formula' input argument. |
se |
The 'se' input argument. |
vcov |
Covariance matrix. |
gformula for estimating expected counterfactual outcomes under multiple intervention values.
data(EFV)
gf <- gformula(
X = EFV, Anodes = c("efv.0", "efv.1", "efv.2", "efv.3", "efv.4"),
Ynodes = c("VL.0", "VL.1", "VL.2", "VL.3", "VL.4"),
Lnodes = c("adherence.1", "weight.1", "adherence.2", "weight.2",
"adherence.3", "weight.3", "adherence.4", "weight.4"),
abar = seq(0, 5), B = 10, ret = TRUE
)
msm(gf, VL.4 ~ efv.4, se = "bootstrap") # default if B>0
msm(gf, VL.4 ~ efv.4, se = "glm") # fast, but not valid (undercoverage)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.