ivDiag
is toolkit for estimation and diagnostics with instrumental
variable (IV) designs. It provides R
implementations of the guidelines
proposed in Lal et al. (2023), enabling researchers to obtain reliable
and robust estimates of their IV models.
Examples: R
code used in the
tutorial
can be downloaded from
here.
Reference: : Lal, Apoorva, Mackenzie William Lockhart, Yiqing Xu, and Ziwen Zu (2023). How Much Should We Trust Instrumental Variable Estimates in Political Science? Practical Advice Based on 67 Replicated Studies, Mimeo, Stanford University.
You can install the ivDiag package from CRAN:
install.packages("ivDiag", repos='http://cran.us.r-project.org')
You can also install the up-to-date development version from Github:
library(remotes)
install_github("apoorvalal/ivDiag")
ivDiag depends on the following packages, which will be installed automatically when ivDiag is being installed:
require(foreach)
require(future)
require(doParallel)
require(lfe)
require(fixest)
require(ggplot2)
require(ggfortify)
require(wCorr)
require(haven)
require(glue)
require(patchwork)
require(testthat)
You can use the following code to install the required packages:
install_all <- function(packages) {
installed_pkgs <- installed.packages()[, "Package"]
for (pkg in packages) {
if (!pkg %in% installed_pkgs) {
install.packages(pkg)
}
}
}
packages <- c("foreach", "future", "doParallel", "lfe", "fixest", "ggplot2",
"ggfortify", "wCorr", "haven", "glue", "patchwork", "testthat")
install_all(packages)
This package is a work in progress. Github issues and/or pull requests are welcome.