install.packages("fect")
1 Get Started
This chapter provides installation instructions and introduces the datasets used in the tutorial.
1.1 Installation
To install fect from CRAN, run the code chunk below:
We recommend users to install the most up-to-date version of fect from Github using:
devtools::install_github("xuyiqing/fect")
After installation, check fect version to make sure the package is up-to-date.
installed.packages()["fect", "Version"]
#> [1] "2.0.1"
panelView for panel data visualization is highly recommended and will be used in the tutorial:
devtools::install_github('xuyiqing/panelView')
fect depends on the following packages, which should be installed automatically when fect is being installed. You can also install them manually.
install_all <- function(packages) {
installed_pkgs <- installed.packages()[, "Package"]
for (pkg in packages) {
if (!pkg %in% installed_pkgs) {
install.packages(pkg)
}
}
}
packages <- c("abind", "doParallel", "doRNG", "fixest", "foreach", "future",
"GGally", "ggplot2", "grid", "gridExtra", "Mass",
"panelView", "Rcpp")
install_all(packages)
1.2 Datasets
The fect package ships five datasets.
Below is a brief explanation of the datasets used in this book:
-
simdata
: Based on Liu, Wang, and Xu (2024). Used in Chapter 2 to demonstrate various counterfactual estimators.
-
gs2020
: Based on Grumbach and Sahn (2020), who examine the effect of minority candidate presence on the proportion of coethnic donations in U.S. House elections. Used in Chapter 3 and Chapter 5.
-
simgsynth
&turnout
: Based on Xu (2017). Used in Chapter 4 to demonstrate Gsynth. -
hh2019
: Based on Hainmueller and Hangartner (2019), who study the effect of indirect versus direct democracy on naturalization rates in Switzerland. Used in Chapter 5.