interflex estimates, visualizes, and interprets conditional marginal effects and performs diagnostics.
Authors: Jens Hainmueller, Jiehan Liu, Licheng Liu, Ziyi Liu, Jonathan Mummolo, Tianzhu Qin, and Yiqing Xu (maintainer)
Date: Feburary 12, 2025
Repos: Github (1.3.2) CRAN (1.2.6)
Tutoralis: See tutorials for cases with continuous and discrete outcomes, as well as a tutorial for double/debiased machine learning (DML) estimators.
Examples: R code used in the tutorials can be downloaded from here.
Reference: How Much Should We Trust Estimates from Multiplicative Interaction Models? Simple Tools to Improve Empirical Practice. Political Analysis, Vol. 27, Iss. 2, April 2019, pp. 163–192.
Installation
You can install the interflex package from CRAN:
install.packages('interflex', type = "source",
repos = 'http://cran.us.r-project.org')
Or you can install the up-to-date development version from Github:
# if not already installed
install.packages('devtools', repos = 'http://cran.us.r-project.org')
# install from github
devtools::install_github('xuyiqing/interflex')
interflex depends on the following packages, which will be installed automatically when interflex is being installed; if not, please install them manually:
# Function to install packages
install_all <- function(packages) {
installed_pkgs <- installed.packages()[, "Package"]
for (pkg in packages) {
if (!pkg %in% installed_pkgs) {
install.packages(pkg, repos = 'http://cran.us.r-project.org')
}
}
}
# Packages to be installed
packages <- c("Rcpp", "mgcv", "sandwich", "pcse", "fixest", "foreach", "doParallel",
"lfe", "lmtest", "Lmoments", "ggplot2", "plotrix", "grid",
"gridExtra", "ggplotify", "ggpubr", "RColorBrewer", "grDevices",
"gtable", "MASS", "mvtnorm", "pROC", "ModelMetrics", "foreign",
"patchwork", "rmarkdown")
# Install the packages
install_all(packages)
Mac users who encounter “-lgfortran” or “-lquadmath” error during installation, please check out the solution here. Typing the following two lines of code in your Terminal should solve this problem.
curl -OL http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /
Mac users who encounter clang: error: unsupported option ‘-fopenmp’, please consider (1) updating your R and/or (2) installing new R macro tools from Github.