This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Title: Estimating variance with PS-based methods | |
| # Description: Demonstrating two different ways to estimate variance | |
| # after using PS-based methods. | |
| # Setup ---- | |
| library(tidyverse) # ol faithful | |
| library(broom) # tidying the model results | |
| library(sandwich) # for robust variance estimator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Title: Diagnostic Plots for Logistic Regression | |
| # Description: These diagnostic plots are recommended for logistic regression in | |
| # Hosmer & Lemeshow. Creating this code to show how to make them in R. | |
| # Setup ---- | |
| #... Libraries ---- | |
| library(tidyverse) # ol faithful |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Title: Parametric G-Formula vs IPTW | |
| # Description: Comparing results from parametric g-formula to results from IPTW. | |
| # These methods model different things. The parametric g-formula models the outcome | |
| # while IPTW models the treatment. The goal of this code is to show how they differ, | |
| # but are not drastically different (in this example with minimal model misspecification). | |
| # Setup ---- | |
| library(tidyverse) # ol faithful |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Title: IPCW for KM Curves | |
| # Description: Demonstrating using inverse probability of censoring weighting for | |
| # Kaplan-Meier Curves. | |
| # Setup ---- | |
| #... Libraries ---- | |
| library(tidyverse) # ol faithful |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Title: Variable Selection Based on P-Values vs DAGs | |
| # Description: The purpose of this code is to show how variable selection | |
| # based on p-values can lead to more biased results than using DAGs. | |
| # Setup ---- | |
| library(tidyverse) # ol faithful | |
| # Simulating Data ---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Title: Checking the Proportional Hazards Assumption | |
| # Description: Two ways to test the proportional hazards assumption from a Cox | |
| # PH model. One is the Grambsch-Therneau test, while another is plotting the | |
| # Schoenfeld residuals over time. Other methods will be for future posts | |
| # Setup ---- | |
| #... Libraries ---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Title: Bootstrapping | |
| # Description: Showing what bootstrapping is and how it can be useful. | |
| # Setup ---- | |
| #... Libraries ---- | |
| library(tidyverse) # ol' faithful | |
| library(tidymodels) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Title: Stabilized vs Nonstabilized Weights | |
| # Description: Showing stabilized vs nonstabilized weights using a density plot. | |
| # Setup ---- | |
| #... Libraries ---- | |
| library(tidyverse) # ol' faithful | |
| library(broom) # cleaning model outputs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Title: Multiple Imputation | |
| # Description: Showing very, very briefly how multiple imputation works. This was inspired by the | |
| # section on multiple imputation in Flexible Imputation of Missing Data by Stef van Buuren. | |
| # Setup ---- | |
| #... Libraries ---- | |
| library(tidyverse) # ol' faithful |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Title: Checking the Proportional Hazards Assumption using Log-Log Plot | |
| # Description: Showing how to check the PH assumption using the log-log plot. | |
| # Setup ---- | |
| #... Libraries ---- | |
| library(tidyverse) # ol' faithful | |
| library(simsurv) # for simulating survival (TTE) data |