Implementing the Sensitivity Analysis

The application of the Impact Threshold for a Confounding Variable (ITCV) analyses can be done with specific commands in R and Stata. After the regression estimation, the subsequent sensitivity analysis can be conducted using the konfound command. The ITCV can be used for ordinary least squares, poisson, tobit, and weighted regression as well as for fixed and random effects. The robustness of inference to replacement (RIR), an extension of the ITCV based on the same logic (Frank et al. 2021), can be used for all aforementioned analyses plus logit and probit regressions.

The konfound package in R from Narvaiz et al. (2024) available at (https://cran.r-project.org/web/packages/konfound/index.html) can be used to implement sensitivity analysis with the following code.

#load the konfound package
library (konfound)

#run the regression model
model <- lm(Outcome ~ Predictor + Controls, data = Dataset)

#run konfound
konfound(model, var = “Predictor”, alpha = 0.05)

The konfound package in Stata from Xu, Frank, Maroulis, and Rosenberg (2019) available at https://journals.sagepub.com/doi/pdf/10.1177/1536867X19874223 can be used to implement sensitivity analysis with the following code.

//installing the software packages
ssc install konfound
ssc install indeplist
ssc install matsort
ssc install moss

//run the regression model
regress Outcome Predictor Controls

//run konfound
konfound Predictor, sig(0.05)

 

References

Frank, Kenneth A., Qinyun Lin, Spiro Maroulis, Anna S. Mueller, Ran Xu, Joshua M. Rosenberg, Christopher S. Hayter, Ramy A. Mahmoud, Marynia Kolak, Thomas Dietz, and Lixin Zhang (2021), “Hypothetical Case Replacement can be used to Quantify the Robustness of Trial Results,” Journal of Clinical Epidemiology, 134, 150–159

Narvaiz, Sarah, Qinyun Lin, Joshua M. Rosenberg, Kenneth A. Frank, Spiro J. Maroulis, Wei Wang, and Ran Xu (2024), “konfound: An R Sensitivity Analysis Package to Quantify the Robustness of Causal Inferences,” Journal of Open Source Software, 9(95), 5779.

Xu, Ran, Kenneth A. Frank, Spiro J. Maroulis, and Joshua M. Rosenberg (2019), “konfound: Command to Quantify Robustness of Causal Inferences,” The Stata Journal, 19(3), 523-550.