Tests the distributional assumption on the composed error using the characteristic function of the centred residuals, without ever evaluating the composed-error density or distribution function.
cw_test(x, model_name = NULL, tau = 1, type = c("cosine", "sine"),
data = NULL, n_nodes = 256L)An object of class "cw_test": the statistic D, its degrees of
freedom and p-value, the moment estimates of \(\sigma_v\) and
\(\sigma_u\), and the frequencies used.
An "sfareg" fit, or a numeric vector of regression residuals
-- ordinary least squares residuals are enough.
The distributional pair under the null. Required when
x is a numeric vector; taken from the fit otherwise. One of
"NHN", "NE", "NR", "NU", "NGE".
Frequency at which the characteristic function is compared. Chen and Wang suggest a value around 1, and a single frequency: combining several oversizes the test (see Details).
"cosine" (recommended) or "sine".
The data the model was fitted to, when x is a fit.
Quadrature nodes for the theoretical moments.
Why this test rather than gof_test. It never touches the
composed-error PDF or CDF. It compares the empirical characteristic function
of the centred residuals with its theoretical value, and that follows from the
characteristic functions of the two components separately, which are in
closed form for many pairs whose convolution is not -- the normal-gamma model
being the standard example of a pair with no closed-form composed density.
Centring is what makes it work. A frontier's intercept is not identified separately from \(E[u]\), so the least-squares intercept estimates \(\alpha - E[u]\) rather than \(\alpha\). Centring the residuals cancels that inconsistent intercept outright, which is why the test is valid off an ordinary regression and does not require maximum likelihood. The variance then has to correct for two nuisances -- estimating the scale parameters, and the centring itself. Omitting the second understates the variance and oversizes the test.
Use one frequency, not several. Measured here over 500 replications at a nominal 5%, half-normal data:
| test | \(n\) | \(\tau=1\) | \(\tau=1.5\) | \(\tau=2\) |
| cosine | 500 | 0.070 | 0.054 | 0.050 |
| cosine | 2000 | 0.046 | 0.044 | 0.050 |
| sine | 500 | 0.092 | 0.064 | 0.042 |
| sine | 2000 | 0.068 | 0.062 | 0.064 |
Against exponential inefficiency the cosine test's power at \(\tau = 1\) is 0.231 at \(n = 500\) and 0.952 at \(n = 2000\), against 0.108 and 0.706 for the sine test. Both of Chen and Wang's conclusions reproduce: the cosine test is the less sensitive to the choice of \(\tau\), and the more powerful. Passing several frequencies at once gives rejection rates of 0.09 to 0.15 at a nominal 5%, because the cosine moments at nearby frequencies are close to collinear and the covariance matrix is then near-singular; the authors report the same for their combined \(\tau\).
The moment estimator solves the second- and third-moment equations, which for
"NHN" and "NE" is the closed form of the paper's equation (32)
and is the same inversion sfm(estimator = "cols") uses. A wrongly
signed third moment leaves it with no admissible solution, and that is an
error rather than a number: see skewness_test.
Chen, Y.-T. and Wang, H.-J. (2012). Centered-residuals-based moment estimator and test for stochastic frontier models. Econometric Reviews 31(6), 625--653.
gof_test, spec_test, skewness_test
set.seed(4)
n <- 500
X <- matrix(rnorm(n * 3), n, 3)
y <- X %*% c(1, 1, 1) + rnorm(n, 0, 1) - abs(rnorm(n, 0, 1))
e <- residuals(lm(y ~ X))
cw_test(e, "NHN") # true pair
cw_test(e, "NE") # wrong inefficiency distribution
Run the code above in your browser using DataLab