Estimation of Thresholds in Stata
xtthreshold
– Threshold Estimation for Interactive Fixed Effects Models
xtthreshold
– Threshold estimation for interactive fixed effects models.
xtthreshold depvar indepvars1 | [indepvars2] [if] [in], threshold(thresvar) [csa(varlist1) grid(integer)]
tsset
or xtset
before using xtthreshold
.tsvarlist
help).moremata
package.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 whether z(i,t)
is above or below threshold v
z(i,t)
: the thresholding variableThe model is defined as:
y(i,t) = b₁ x(i,t) + g₁ I(z(i,t) < v) w(i,t) + g₂ I(z(i,t) > v) w(i,t) + u(i,t)
The error term has an interactive fixed effect structure:
u(i,t) = g(i) f(t) + ε(i,t)
Where:
g(i)
: factor loadingf(t)
: common factorε(i,t)
: iid noiseThe estimator uses cross-sectional averages to span the factor space (see Ditzen & Karavias, 2025).
xtthreshold
follows Ditzen et al. (2025) to:
v
using a grid over z(i,t)
b₁
, g₁
, and g₂
v
minimizing the sum of squared residuals (SSR)LR(v₀) = NT × [SSR(v₀) - SSR(v)] / SSR(v)
threshold(thresvar)
: defines the thresholding variable Z
csa(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 thresholds
Download data from the GitHub repository.
xtthreshold gdppcgr govspend khanvar | open popgr grosscap, threshold(khanvar) grid(400) csa(govspend khanvar open popgr grosscap)
estat split
xtdcce2
)xtdcce2 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://github.com/JanDitzen/xtthreshold
Version 0.1 – 24.07.2025