Description Usage Arguments Examples

Estimate how the Average Controlled Direct Effect varies by various levels of unobserved confounding. For each value of unmeasured confounding, summarized as a correlation between residuals, cdesens computes the ACDE. Standard errors are computed by a simple bootstrap.

1 2 3 4 5 6 7 8 9 |

`seqg` |
Output from sequential_g. The function only supports specifications with one mediator variable. |

`var` |
A character indicating the name of the variable for which the estimated ACDE is being evaluated. |

`rho` |
A numerical vector of correlations between errors to test for. The original model assumes rho = 0 |

`bootstrap` |
character of c("none", "standard"), indicating whether to include bootstrap standard errors. Default is "none". |

`boots_n` |
Number of bootstrap replicates, defaults to 100. |

`verbose` |
Whether to show progress and messages, defaults to FALSE |

`...` |
Other parameters to pass on to lm.fit() when refitting the model |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
data(civilwar)
# main formula: Y ~ A + X | Z | M
form_main <- onset ~ ethfrac + lmtnest + ncontig + Oil | warl +
gdpenl + lpop + polity2l + relfrac | instab
# estimate CDE
direct <- sequential_g(form_main, data = civilwar)
# sensitivity
out_sens <- cdesens(direct, var = "ethfrac")
# plot sensitivity
plot(out_sens)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.