Interflex
Multiplicative Interaction Models Diagnostics and Visualization, Producing Flexible Marginal Effect Estimates
Install / Use
/learn @xuyiqing/InterflexREADME
interflex
<!-- badges: start --> <!-- badges: end -->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.
Report bugs
Please report bugs to yiqingxu [at] stanford.edu with your sample code and data file. Much appreciated!
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
