Learn R Programming

sfa (version 1.2.0)

cw_test: Chen and Wang (2012) centered-residuals moment test

Description

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.

Usage

cw_test(x, model_name = NULL, tau = 1, type = c("cosine", "sine"),
        data = NULL, n_nodes = 256L)

Value

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.

Arguments

x

An "sfareg" fit, or a numeric vector of regression residuals -- ordinary least squares residuals are enough.

model_name

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".

tau

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).

type

"cosine" (recommended) or "sine".

data

The data the model was fitted to, when x is a fit.

n_nodes

Quadrature nodes for the theoretical moments.

Details

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\)
cosine5000.0700.0540.050
cosine20000.0460.0440.050
sine5000.0920.0640.042
sine20000.0680.0620.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.

References

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.

See Also

gof_test, spec_test, skewness_test

Examples

Run this code
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