This is meant to provide a worked example of applying standardization (G-computation) to a binary outcome in R.
-
Make sure you have the latest version of R and R Studio installed.
-
Make sure that your packages are up to date (see
update.packages()). -
If using Windows, install RTools: Toolchains. Mac and Linux should already have compilers available for building packages from source.
-
Open R Studio: Select
File>New Project>Version Control>Git:
- In the `Repository URL:` field, paste `https://github.com/CovariateAdjustment/BinaryOutcomeTutorial`
- In the `Project directory name:` field, paste `BinaryOutcomeTutorial`
- Choose a directory for cloning the repo.
- R Studio will open the project once it is cloned: Run
0_install_required_packages.r: This will install packages from R and CRAN.
After these steps are complete, open
Covariate_Adjustment_Handout_Binary: This R Markdown report provides a
step-by-step example of materials in the slides.
- `Simulated_MISTIE_III_v1.2.csv” - A spreadsheet of the data used in the example
sim_MIII_MRS.Rdata- Materials used in handouts and slidessim_MIII_MRS_fixed.Rdata- Cached results used in handouts and slides
-
boot_p_value.Rcontainsboot_p_value()which can take abootobject produced byboot::boot()and calculate a p-value by finding the smallest confidence level$\alpha$ at which the null hypothesis is rejected (i.e. the CI no longer contains the null value of the parameter).
Covariate_Adjustment_Slides_Binarycontains the slides used in short coursesCovariate_Adjustment_Handout_Binaryshows a reproducible report that walks through all of the code examples in the slides.
In order to reduce compiling/computing time due to the bootstrap, results are computed and cached. This code is available for users to see how the example data and results were created.