xtthreshold – Threshold estimation for interactive fixed effects models.
xtthreshold depvar indepvars1 | [indepvars2] [if] [in], threshold(thresvar) [csa(varlist1) grid(integer)]- Data must be
tssetorxtsetbefore usingxtthreshold. - Variables may include time-series operators (see
tsvarlisthelp). - Requires the
morematapackage.
Variable Notes:
thresvar: thresholding variable.indepvars1: variables affected by the threshold.indepvars2: variables not affected by the threshold.varlist1: variables added as cross-section averages.
We consider a panel dataset over cross-sectional units i and time t, with three sets of independent variables:
x(i,t): unaffected by the thresholdw(i,t): effects depend on whetherz(i,t)is above or below thresholdvz(i,t): the thresholding variable
The model is defined as:
The error term has an interactive fixed effect structure:
Where:
g(i): factor loadingf(t): common factorε(i,t): iid noise
The estimator uses cross-sectional averages to span the factor space (see Ditzen & Karavias, 2025).
xtthreshold follows Ditzen et al. (2025) to:
- Estimate the threshold
vusing a grid overz(i,t) - Estimate coefficients
b₁,g₁, andg₂ - Choose
vminimizing the sum of squared residuals (SSR)
threshold(thresvar): defines the thresholding variableZcsa(varlist1): adds variables as cross-section averagesgrid(integer): length of the threshold grid (default: 100)
You can use estat to explore and visualize results:
estat split // Splits variables in indepvars1 at threshold
estat graph lr // Graphs LR test across thresholdsDownload data from the GitHub repository.
xtthreshold gdppcgr govspend khanvar | open popgr grosscap, threshold(khanvar) grid(400) csa(govspend khanvar open popgr grosscap)estat splitxtdcce2 gdppcgr govspend_0 khanvar_0 govspend_1 khanvar_1 open popgr grosscap, cr(govspend khanvar open popgr grosscap)estat graph lr-
Ditzen, J. & Karavias, Y. (2025)
Interactive, Grouped and Non-separable Fixed Effects: A Practitioner’s Guide to the New Panel Data Econometrics
Link -
Ditzen, J., Karavias, Y. & Westerlund, J. (2025)
Threshold Regression in Interactive Fixed Effects Panel Data and the Impact of Inflation on Economic Growth
Link
Jan Ditzen
Free University of Bozen-Bolzano
📧 jan.ditzen@unibz.it
🌐 Webpage
Yiannis Karavias
Brunel University
📧 yiannis.karavias@brunel.ac.uk
🌐 Webpage
Joakim Westerlund
Lund University
📧 joakim.westerlund@nek.lu.se
🌐 Webpage
Run the following command in Stata to install:
net from https://janditzen.github.io/xtthreshold/- Requires Stata version 16 or higher.
Version 0.1 – 24.07.2025