*! version 1.0.0 09jun2026

Title

xttestpanel func -- Nonparametric functional-form test (Lin, Li & Sun 2014)

Syntax

xttestpanel func [depvar indepvars] [if] [in]
[, reps(#) bw(#) graph]

This is a fixed-effects test. The postestimation form refits with FE if the model
in memory is not FE.

Description

xttestpanel func implements the consistent nonparametric specification test of
Lin, Li & Sun (2014) for the linear functional form of a fixed-effects panel
regression. The null is that the parametric (linear) form is correct; the alternative
is any smooth nonparametric departure.

The statistic is a kernel-weighted quadratic form in the FE within residuals,

J_n = sum_(i != j) e_i e_j K_h(x_i - x_j) / (n(n-1)),

standardized by its estimated variance to a J_n ~ N(0,1) limit (upper-tailed:
large positive values reject linearity). Because the asymptotic approximation can be
poor in finite samples, a wild bootstrap p-value (Rademacher weights) is also
reported and is the recommended one for inference.

A Gaussian product kernel is used on the standardized regressors with a Silverman-type
bandwidth h = n^(-1/(4+p)), overridable with bw().

Options

reps(#) number of wild-bootstrap replications; default 199. Use
299-499 for publication.

bw(#) kernel bandwidth on the standardized regressor scale; default is the
Silverman rule.

graph FE residuals against the first regressor with a lowess curve; a
non-flat curve indicates misspecification.

Performance note: the test is O(n^2) in the number of observations and is capped
at n = 5000. For larger panels subsample first.

Stored results

r(jn) standardized Lin-Li-Sun statistic

r(p_asy) asymptotic (N(0,1)) p-value

r(p_boot) wild-bootstrap p-value (recommended)

r(bw) bandwidth used

Examples

. xttestpanel func ln_wage age tenure hours, reps(299)

. xttestpanel func ln_wage age tenure hours, bw(0.8) graph

References

Lin, Z., Q. Li, and Y. Sun. 2014. Journal of Econometrics 178: 167-179.

Author

Merwan Roudane - merwanroudane920@gmail.com -
github.com/merwanroudane