Page 1 of 1

Two regressor lists

Posted: Mon Mar 06, 2017 10:12 am
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.

Re: Two regressor lists

Posted: Mon Mar 06, 2017 12:32 pm
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.

Re: Two regressor lists

Posted: Mon Mar 06, 2017 12:53 pm
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

Re: Two regressor lists

Posted: Mon Mar 06, 2017 1:12 pm
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.

Re: Two regressor lists

Posted: Mon Mar 06, 2017 7:37 pm
by randal_verbrugge
Aha, got it.

Thanks very much!