RATS 11.1
RATS 11.1

The Testing “Trinity”

The three main types of tests are the Wald, Likelihood Ratio and Lagrange multiplier, known as the testing trinity. This is covered in just about any modern graduate econometrics text, such as Greene (2012) or Wooldridge (2010).

 

Lagrange multiplier (LM) tests start by estimating a model under the null hypothesis. The gradient of the (log) likelihood or analogous optimand will be zero in the restricted model itself, and if the null is true, it would be expected to be close to zero in the alternative (expanded) model. The LM tests are often much easier to compute than the other two tests, because they require only that you be able to compute the restricted model, and the gradient (and some approximation to the information matrix) of the expanded model evaluated at the restricted model. Since the extra parameters are typically zero under the null, the gradient often simplifies quite a bit when computed under the null. In particular, if the added parameters (\(\alpha\)) enter in the form

\begin{equation} h\left( {z'_t {\kern 1pt} {\kern 1pt} \alpha } \right) \end{equation}

where \(\alpha = 0\) under the null, the derivative with respect to \(\alpha\) is

\begin{equation} h'(z'_t \alpha )z_t \end{equation}

which under the null simplifies to \(h'(0)z'_t\), which is proportional to \(z'_t \) regardless of the form of the \(h\) function.

 

While the LM tests have a general structure which unites them, they can take a wide variety of forms once you simplify the gradient calculation in a specific case. However, there are two main forms which appear repeatedly: the auxiliary regression and the Outer Product of the Gradient (OPG). Note, by the way, that these two can be different ways of doing the same calculation.

Auxiliary Regression LM Tests

An auxiliary regression is a secondary regression which includes some variables generated from your primary regression, typically a function of the residuals. The actual test is usually either for the regression having a zero \(R^2\), or for some regressor or regressors having zero coefficients. The latter type of test can be done by just using an EXCLUDE on the coefficients in question. Depending upon the situation, the \(R^2\) tests may be based upon either the centered \(R^2\) or the uncentered one, the latter if a zero constant is implied by the null. After a LINREG, the variable %TRSQ returns the number of observations times the uncentered \(R^2\), while %TRSQUARED will give the number of observations times the centered \(R^2\).

 

For instance, the following is part of example 6.3 in Wooldridge (2010). It does an overidentification test, determining if there is correlation between the residuals from an instrumental variables regression and the list of instruments.

 

instruments constant exper expersq motheduc fatheduc huseduc

linreg(instruments) lwage / resids

# constant exper expersq educ

linreg resids

# constant exper expersq motheduc fatheduc huseduc

cdf(title="Overidentification Test by Auxiliary Regression") $

 chisqr %trsq 2

 

OPG Tests

The outer product of the gradient form of the test can be used when the gradient can be written as \(\sum {g_t } \) with sufficient regularity conditions that

\begin{equation} \sum {g_t } \left( {\sum {g_t ^\prime g_t } } \right)^{ - 1} \sum {g_t ^\prime } \end{equation}

is asymptotically distributed as a \(\chi ^2\).

 

You will often see this described as being done by a regression of a vector of 1’s on the gradient components. The test statistic is then the sum of squared fitted values from that regression, which is the same (in this case) as the number of observations minus the sum of squared residuals. RATS offers a more convenient way to compute this in most cases. In order to run this (literally) as a regression of 1’s on the gradient components, you need to create series for those components. However, in a wide range of cases, the gradient components will just be the product of residuals (or some other series) with a set of already existing variables. If this is the case, you can compute the test statistic using MCOV with the OPGSTAT option. 

 

mcov(opgstat=computed value) / resids

# gradient variables

 

The “gradient variables” are the variables which are gradient components when they are multiplied by the resids series. Typically, these are the original regressors together with one or more generated series which are supposed to have a zero correlation with the residuals under the null. Remember that if the original regressors are included in this list, the degrees of freedom of the test will be reduced, as those will typically have gradient components which are forced to sum to zero under the null hypothesis.

 

This is from the same example for Wooldridge as above. It does a “robust” overidentification test, determining if there is a correlation between the residuals from an instrumental variables regression and the residuals from regressions of the two potentially endogenous variable on their instruments.

 

linreg motheduc / rmoth

# constant exper expersq educhat

linreg fatheduc / rfath

# constant exper expersq educhat

 

mcov(opgstat=lmrobust) / resids

# rmoth rfath

cdf(title="Robust Overidentification Test") chisqr lmrobust 2

 

Note that you can also use the @RobustLMTest procedure for this.


Copyright © 2026 Thomas A. Doan