Why does RATS ignore the CMOM option in SYSTEM/ESTIMATE?

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
macro
Posts: 70
Joined: Thu Jul 16, 2015 3:01 pm

Why does RATS ignore the CMOM option in SYSTEM/ESTIMATE?

Unread post by macro »

Consider this code, in RATS 9.0:

Code: Select all

calendar(q) 1969 1

compute begin_samp = 1969:1
compute end_samp   = 2012:4
compute max_lags = 8

smpl begin_samp end_samp

open data "data.xls"
    data(format = xls, org = columns)
close data

cmoment(noprint) begin_samp end_samp
# dlgdpk{0 to max_lags} dlcnsk{0 to max_lags} lgdpk{0 to max_lags} lcnsk{0 to max_lags} constant

linreg(cmom, print) dlgdpk
# dlgdpk{1 to 2}

linreg(print) dlgdpk
# dlgdpk{1 to 2}

system(model = mdl, cmom)
    variables dlgdpk dlcnsk
    lags 1 to 2
    deterministic constant
end(system)
estimate(model = mdl)

system(model = mdl)
    variables dlgdpk dlcnsk
    lags 1 to 2
    deterministic constant
end(system)
estimate(model = mdl)
The linear regression with the CMOM option outputs:

Code: Select all

linreg(cmom, print) dlgdpk
# dlgdpk{1 to 2}

Linear Regression - Estimation by Least Squares
Dependent Variable DLGDPK
Quarterly Data From 1969:01 To 2012:04
Usable Observations                       167
Degrees of Freedom                        165
Skipped/Missing (from 176)                  9
Centered R^2                        0.0589709
...
while omitting the CMOM option gives:

Code: Select all

linreg(print) dlgdpk
# dlgdpk{1 to 2}

Linear Regression - Estimation by Least Squares
Dependent Variable DLGDPK
Quarterly Data From 1969:04 To 2012:04
Usable Observations                       173
Degrees of Freedom                        171
Centered R^2                        0.0310736
...
as expected. However, the VAR estimation with and without the CMOM option displays the same output:

Code: Select all

system(model = mdl, cmom)
    variables dlgdpk dlcnsk
    lags 1 to 2
    deterministic constant
end(system)
estimate(model = mdl)

VAR/System - Estimation by Least Squares
Quarterly Data From 1969:04 To 2012:04
Usable Observations                       173
...
I was hoping to use the CMOM option to ensure that my code uses exactly the same sample period, across every univariate and multivariate specification in my code. Is this a bug, or is this the intended behaviour? If this is the intended behaviour, how can I ensure that I do use precisely the same sample across every specification?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Why does RATS ignore the CMOM option in SYSTEM/ESTIMATE?

Unread post by TomDoan »

It's just an internal flag for how to do the calculation with a mixed set of equations---it doesn't refer to the global CMOM. If you're trying to enforce a particular sample based upon the maximum range permitted by a set of variables and lags, use INQUIRE with the MODEL, EQUATION or REGRESSORLIST option (whichever seems most convenient) to figure that out once. Then use the values you get on the start and end parameters on the estimation instructions.
macro
Posts: 70
Joined: Thu Jul 16, 2015 3:01 pm

Re: Why does RATS ignore the CMOM option in SYSTEM/ESTIMATE?

Unread post by macro »

TomDoan wrote:It's just an internal flag for how to do the calculation with a mixed set of equations---it doesn't refer to the global CMOM. If you're trying to enforce a particular sample based upon the maximum range permitted by a set of variables and lags, use INQUIRE with the MODEL, EQUATION or REGRESSORLIST option (whichever seems most convenient) to figure that out once. Then use the values you get on the start and end parameters on the estimation instructions.
The CMOM option for LINREG, however, is referring to the global CMOM, right? If I understand correctly, I just need code like this

Code: Select all

inquire(regressorlist) begin_est end_est
# dlgdpk{0 to max_lags} dlcnsk{0 to max_lags} lgdpk{0 to max_lags} lcnsk{0 to max_lags}

smpl begin_est end_est
followed by all my regressions, lag selection (using AIC, for example), etc., to guarantee that they'll all use the same sample? I initially used CMOMENT by following the example on UG-64 (of the RATS 9.0 manuals), which recommends using CMOMENT to fix the sample across regressions. I didn't realize that this option didn't apply to the SYSTEM and ESTIMATE commands.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Why does RATS ignore the CMOM option in SYSTEM/ESTIMATE?

Unread post by TomDoan »

Yes, though I don't recommend using the SMPL instruction. (It's just too easy to forget to disable it when you're done with the intended set of instructions). Just use the parameters on the estimation instruction to set the range.
macro
Posts: 70
Joined: Thu Jul 16, 2015 3:01 pm

Re: Why does RATS ignore the CMOM option in SYSTEM/ESTIMATE?

Unread post by macro »

TomDoan wrote:Yes, though I don't recommend using the SMPL instruction. (It's just too easy to forget to disable it when you're done with the intended set of instructions). Just use the parameters on the estimation instruction to set the range.
This is great; thank you. INQUIRE was exactly what I was looking for, and I prefer to manually specify estimation dates anyway, since it makes code easier (for me) to read and I know precisely what the code is estimating without having to look for a SMPL instruction.
Post Reply