Two regressor lists

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.
randal_verbrugge
Posts: 14
Joined: Mon Sep 23, 2013 10:43 am

Two regressor lists

Unread post by randal_verbrugge »

Hi everyone,

I am developing a proc that implements "unusual observation detection" in conjunction with a paper I am revising (joint work with Christian Garciga). Use of this procedure will help you detect weird observations (e.g., if you are cleaning data), to determine if your results are being driven by a small set of unusual observations, or to determine if you need to consider enriching your model by, e.g., implementing regime switching. (The procedure is up and running, but so far does not handle categorical variables gracefully.)

I require the procedure to read in two lists of variables: first a list of all continuous variables, and then a list of all categorical variables (if there are any).

Right now, I am using the standard code to pull the data into the procedure:

Enter(varying) VARID
Inquire(matrix=varid) K

Instructions like CMOMENT allow the user to input two lists of variables like this, but I don't think we can look at the code for instructions.

Thanks,
Randy

PS the new Enders programming manual does not seem to have a chapter on writing procedures.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Two regressor lists

Unread post by TomDoan »

I would generally do those as two separate EQUATION instructions.

local equation conteq cateq
equation conteq *
equation cateq *

You can then use functions like %eqntable, %tablemerge and %rlfromtable to manipulate the variable lists that you get from those. See, for instance, the BBEGIBBS.RPF example program from the Bernanke, Boivin, Eliasz replication, which uses EQUATIONS to handle the slow and fast moving variables.
randal_verbrugge
Posts: 14
Joined: Mon Sep 23, 2013 10:43 am

Re: Two regressor lists

Unread post by randal_verbrugge »

Hi Tom,

thanks for replying.

I must be dense because I don't see how this gets information from the main program into the procedure. Ideally, I want a user to give two lists of variables, which are passed to a proc.

How does " equation conteq * " accomplish that?

Would I need to define *global* equations which are then passed (implicitly)?

Sorry if these are really dumb questions.

best,
Randy
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Two regressor lists

Unread post by TomDoan »

For example:

procedure test
local equation myeqn
equation myeqn *
end

@test

will expect a supplementary card after the @test line to provide the list of regressors (variables) to create the MYEQN inside the procedure. The CANCORR procedure is an example of a procedure which pulls in multiple sets of variables from different supplementary cards.
randal_verbrugge
Posts: 14
Joined: Mon Sep 23, 2013 10:43 am

Re: Two regressor lists

Unread post by randal_verbrugge »

Aha, got it.

Thanks very much!
Post Reply