*! version 1.0.0 03jul2026

Title

xtfmg fsurmg -- Fourier Seemingly Unrelated Regressions Mean
Group (F-SURMG) estimator

Syntax

xtfmg fsurmg depvar indepvars [if] [in] [, options]

kfreq(#) Fourier frequency k; default kfreq(1)

level(#) confidence level; default level(95)

heteroplot forest plot of the unit-specific slopes

focus(varname) regressor shown in the heterogeneity plot

fourierplot plot the estimated unit-specific Fourier components

notable suppress the coefficient table

saving(filename) export the table in journal format
(.tex, .rtf/.doc, .csv or .txt); see
xtfmg fccemg

title(string) caption for the exported table

replace overwrite the export file if it exists

Requires a balanced panel with T > N on the estimation
sample, so the N x N contemporaneous error covariance can be estimated.

Description

xtfmg fsurmg estimates the system of unit equations

y_it = a_i + b_i' x_it + g_i sin(2 pi k t/T) + l_i cos(2 pi k t/T) + e_it,
i = 1, ..., N,

jointly as a seemingly unrelated regression: an initial equation-by-equation
OLS provides residuals from which the N x N contemporaneous error covariance
is estimated, and the system is then re-estimated by feasible generalized
least squares. The F-SURMG estimate is the mean-group average of the FGLS
unit slopes, with the nonparametric Pesaran-Smith (1995) variance. The
efficiency gain comes entirely from the off-diagonal elements of the error
covariance -- the manifestation of the common factors -- and
is realisable only when T is large relative to N.

The unit-specific Fourier pair approximates structural breaks of unknown
number, timing and form occurring at different dates in different units
(Becker, Enders and Lee 2006; Enders and Lee 2012), while consuming only two
degrees of freedom per unit, unlike dummy-variable schemes.

F-SURMG does not include cross-sectional averages and so does not filter the
common factor directly; it is designed for the small-N, weak-dependence
corner of the regime map, where the Monte Carlo evidence in Guliyev (2026)
shows it delivers the best-calibrated inference (N around 5). As the
dependence strengthens, the uncorrected factor bias becomes decisive and
xtfmg fccemg should be used instead.

Options

kfreq(#) sets the Fourier frequency; default 1. See
xtfmg fccemg.

level(#), heteroplot, focus(varname), fourierplot,
notable: as in xtfmg fccemg.

Remarks

If the estimation sample is unbalanced, or T <= N, or any unit equation is
collinear, the command exits with an informative error (r(459)): the SUR
covariance cannot be estimated reliably in those cases. Use
xtfmg fccemg or xtfmg mg for
unbalanced panels.

The smooth Fourier approximation represents a sharp, instantaneous break
only imperfectly; it captures the low-frequency content of the shift, which
is adequate for estimating the mean slope but should be borne in mind when
the breaks are genuinely abrupt.

Stored results

Identical to xtfmg fccemg with
r(estimator) = fsurmg: scalars r(N), r(N_used),
r(N_skip), r(Tbar), r(n), r(k), r(kfreq),
r(cd), r(cd_p), r(alpha); matrices r(b),
r(V), r(bunit), r(seunit) (each with sin and
cos columns).

Examples

. webuse grunfeld, clear

. xtset company year

. xtfmg fsurmg invest mvalue kstock

. xtfmg fsurmg invest mvalue kstock, fourierplot kfreq(2)

References

Becker, R., W. Enders, and J. Lee. 2006. A stationarity test in the
presence of an unknown number of smooth breaks.
Journal of Time Series Analysis 27: 381-409.

Enders, W., and J. Lee. 2012. A unit root test using a Fourier series
to approximate smooth breaks.
Oxford Bulletin of Economics and Statistics 74: 574-599.

Guliyev, H. 2025. Heterogeneous panel data model with sharp and smooth
changes: Testing the green growth hypothesis in G7 countries.
Innovation and Green Development 4(3): 100245.

Guliyev, H. 2026. Second-generation heterogeneous panel data model
with individual and common shocks. arXiv:2606.29063.

Author

Merwan Roudane

merwanroudane920@gmail.com

https://github.com/merwanroudane