MCOV Instruction |
MCOV(options) start end list of residuals
# list of regressors in Regression Format
MCOV (short for Matrix COVariogram) calculates the key building block for calculations which are robust to heteroscedasticity and autocorrelation. While these are included directly in many RATS estimation instructions, there are situations where the calculations done by MCOV are useful by themselves.
Parameters
start, end |
Range of entries to use. If you have not set a SMPL, this defaults to:
•the range of the most recent regression, if you use the option LASTREG. •the maximum range over which all the regressors are defined, otherwise.
|
residuals |
This is a list of one or more series of residuals. If you omit this, it's treated as a series of 1's. |
Options
See technical details for a more complete explanation of the calculations and the main options (LAGS, LWINDOW, CLUSTER).
LAGS=correlated lags [0]
The number of lags of autocorrelation (in the form of moving average terms) that you want included. There are certain technical problems which arise when LAGS is non-zero which typically require a choice for LWINDOW other than the default of LWINDOW=FLAT. For the quadratic spectral window (LWINDOW=QUADRATIC), LAGS gives the bandwidth, since a full set of lags are always used with that. For other window types, note that RATS counts the number of correlated lags, which is one less than the width that is often used in descriptions of these window. LAGS can take non-integer values; while this feature is mainly used with the quadratic window, it can be used with the others.
LWINDOW=NEWEYWEST/BARTLETT/DAMPED/PARZEN/QUADRATIC/[FLAT]/PANEL/WHITE
DAMP=value of \(\gamma\) for LWINDOW=DAMPED [0.0]
LWINDOW chooses the form of the lag window to be used. NEWEYWEST and BARTLETT are identical to each other, and to LWINDOW=DAMPED with DAMP=1.0. QUADRATIC is the quadratic spectral window. DAMP gives the parameter \(\gamma\) of the window with LWINDOW=DAMPED (if DAMP is set to something other than 0.0, LWINDOW is automatically set to DAMPED). None of these matter if LAGS is zero, except for PANEL which is a special case of clustered calculation; it’s the equivalent of FLAT with LAGS equal to the number of time periods per individual (minus one).
LWFORM=VECTOR with the window form [not used]
You can use LWFORM as an alternative to LWINDOW if you want to use a window not covered by the choices in LWINDOW, or if you want to use an asymmetrical window. This must have dimension 2 × L + 1, with the first entry giving the lag L value and the last the lead L value. If your window isn’t symmetrical, you need to use the RMATRIX option to get the resulting matrix.
CLUSTER=series with category values for clustered standard errors [not used]
GROUP=series with category values for clustered standard errors [not used]
These are for a general clustered calculation. CLUSTER and GROUP are synonyms.
MODEL=(linear) MODEL providing variables [unused]
EQUATION=equation to supply regressors [unused]
LASTREG/[NOLASTREG]
INSTRUMENTS/[NOINSTRUMENTS]
DEPVAR/[NODEPVAR]
These provide shortcuts for using standard sets of variables. MODEL takes the explanatory variables from a model with linear equations; EQUATION takes these from a single equation, and LASTREG uses the explanatory variables from the last regression (or similar instruction). INSTRUMENTS uses the current set of instruments as the list. If you include any of these options, omit the supplementary card. Use the option DEPVAR with MODEL, EQUATION or LASTREG if you want to include the dependent variable(s) of the equations or regression.
ZUMEAN=VECTOR of means of moment conditions [unused]
This allows you to supply a VECTOR with a set of known (non-zero) mean values for the moment conditions. By default, RATS assumes these are zero.
CENTER/[NOCENTER]
CENTER adjusts the formula to subtract off the (sample) means of the moment conditions, which may be non-zero for an overidentified model.
[ZUDEPENDENT]/NOZUDEP
ZUDEP is the default for MCOV (but not for SUR or NLSYSTEM), as there is little reason to use the MCOV instruction when the instruments and residuals aren’t dependent.
MATRIX=SYMMETRIC array for computed matrix [%CMOM]
RMATRIX=RECTANGULAR array for computed matrix [none]
Use MATRIX to put the computed matrix into a specific SYMMETRIC array. By default, MCOV uses the array %CMOM. If you’ve put in an asymmetric window using LWFORM option, the resulting matrix won’t be a SYMMETRIC, so you must use RMATRIX.
MEANVECTOR=(output) VECTOR for means of moment conditions
Saves the means of the moment conditions into a VECTOR.
OPGSTAT=value for OPG statistic [unused]
Use this to get the OPG statistic (outer-product gradient) used in many LM tests. See "OPGSTAT Option (LM Tests)".
PRINT/[NOPRINT]
Use PRINT if you want to print (display) the computed matrix.
[SQUARE]/NOSQUARE
Use NOSQUARE with v=residuals if you want to compute Z'vZ, rather than Z'uu'Z. The LAGS option is ignored if you use NOSQUARE. This can only be used with a single “v” series.
OPGSTAT Option (LM Tests)
The test statistics for many LM tests take the form
\({\left( {\sum {{\bf{Z'u}}} } \right)^\prime }{\left( {\sum {{\bf{Z'}}{{\bf{u}}^2}{\bf{Z}}} } \right)^{ - 1}}\left( {\sum {{\bf{Z'u}}} } \right)\)
where \(\bf{u}\) is the series of residuals or generalized residuals, and \(\bf{Z}\) the regressors augmented by some other variables. This tests for a zero value of \(\sum {{\bf{Z'u}}}\) . You can compute this using MCOV. Just provide the \(\bf{u}\) and \(\bf{Z}\) series and use the OPGSTAT option. See the second example below. Note that it's up to you to determine the proper degrees of freedom of the test (usually a count of the variables added that weren't in the original regression).
Variables Defined
%CMOM |
The computed matrix (SYMMETRIC) |
%NCMOM |
The dimensions of %CMOM (INTEGER) |
Examples
mcov(lwindow=bartlett,lags=lags) startl+1 endl resids
# constant
computes an estimate of the spectral density of RESIDS at frequency zero, using “LAGS” lags. The computed matrix (which here will be 1 x 1) will be in %CMOM.
mcov(opgstat=sclm) / u
# %reglist() u{1}
cdf(title="LM Test for Serial Correlation") chisqr sclm 1
This computes an LM test using the OPGSTAT option as described above.
Copyright © 2025 Thomas A. Doan