Print

Print


Hi Lexi,

For the second code, you are effectively running a VAR regression for all
variables and the interaction between the variables so thats why you are
getting 9 equations.

If you combine the two files so that you are using the database but looping
over the individual variables then you can get this regression to run only
3 times.  You can loop over the Inflat.Select() command with the addition
of Inflat.DeSelect() and this will simplify your code.

So for example from my code where I have labeled the variables as y1-yK
then:

for(decl k=0; k<K; k++){
model.DeSelect();
model.Select(Y_VAR, {sprint("y", k), 0, 0});
model.Select(U_VAR, {"Constant", 0, 0});
model.Select(X_VAR, {sprint("y", k), 1,1});
model.SetSelSample(1, 1, N-1, 1);
model.SetMethod(M_OLS);
model.Estimate();
}

Andrew

On Tue, Jul 26, 2016 at 11:42 AM, Lexi Setlhare <[log in to unmask]>
wrote:

> Dear Ox Users,
>
> Please find a beginner's question below.
>
> Recently I wrote an ox code to estimate an ADF equation for three
> variables. But I have to write the same code three times for each of the
> variables; only changing the name of the variable in each code.
>
> Then I wondered if I could write on program to estimate the ADF equation
> for all the three variables, for efficiency. This landed me in a difficult
> territory.
> First, I wrote a program to open the three variables, with their
> respective names and values (see attached file called asNamesFile1).
> However, I cannot proceed to run the ADF equation for each variable after
> reading them.
> Second, I wrote a program to read the data using #import <database>. In
> the program I read the each variable, then select dependent variable and
> regressors for each, and then call the regression function. The problem is
> that the regression function estimates the ADF equation 9 times instead of
> 3 times (see attached file called asNamesFile2).
>
> Can someone please assist.
>
> Thanks,
> Lexi
>