Description Usage Arguments Value Examples
View source: R/gestimation-function.R
This function conduct causal inference by implementing g-estimation. Please read (https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/) before applying this test.
1 | gestimation(formula, data, bootstrap = 30, state = 33, verbose = F)
|
formula |
An object of class "formula": a symbolic description of the model to be fitted. The exposure of interest should be plugged-in as the first covariate at the right-hand size of the formula. |
data |
A data frame containing the variables in the model. |
bootstrap |
An integer determining how many times this procedure being repeated by resampling with replacement. |
state |
An integer to set random seed for reproducible results. |
verbose |
A logical determining whether a progress bar is shown. |
output A list containing the formula, exposure of interest, marginal effect, 95% confidence interval (CI), significance by p-value obtained from the CI (https://doi.org/10.1136/bmj.d2304), data, bootstrapping times, random seed, and index for each bootstrap set.
1 2 3 4 5 6 7 | # Load example data for formula and data
input=input_example()
formula=input$formula
data=input$data
# Conduct g-formula
gestimation(formula,data)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.