gestimation: Causal inference by g-estimation

Description Usage Arguments Value Examples

View source: R/gestimation-function.R

Description

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.

Usage

1
gestimation(formula, data, bootstrap = 30, state = 33, verbose = F)

Arguments

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.

Value

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.

Examples

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)

herdiantrisufriyana/gmethods documentation built on Feb. 20, 2021, 3:25 a.m.