Delete duplicated VAR models

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

bdamasio
Posts: 20
Joined: Tue Nov 05, 2013 4:49 am

Delete duplicated VAR models

Postby bdamasio » Wed Dec 09, 2015 9:22 am

Dear all,
I estimated several VAR models with all possible combinations of variables in my database.
However the VAR gdp_inf_unem equals the VAR gdp_unem_inf; the VAR gdp_gfcf_unem_inf equals the VAR gdp_unem_inf_gfcf and the VAR gdp_inf_unem_gfcf and so on.
Do you know how can I delete duplicated VAR in a simple way? I have more than 1000 of duplicated VAR to delete and the included variables identify the VAR names.
Thank you.
B.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: Delete duplicated VAR models

Postby EViews Gareth » Wed Dec 09, 2015 9:41 am

I think the best solution would be to start from the beginning and only estimate the VAR models you need, rather than estimate more than you need and then delete some :D

But to do the deletes, I think you would need to write a double loop that loops through each VAR and compares it with every other VAR. To do the comparison, you'll have to extract the command used in each VAR (var.@command) and then check to see if there are any words in one that aren't in the other (@wnotin).

This will be non-trivial to get working, at a guess.

bdamasio
Posts: 20
Joined: Tue Nov 05, 2013 4:49 am

Re: Delete duplicated VAR models

Postby bdamasio » Thu Dec 10, 2015 8:44 am

The best solution might be to only estimate the VAR models I need, however they are generated through a loop that combines all possible combinations of the variables.
I think that it is not straitforward to estimate non-duplicated VAR models.
I believe it is easier if I use computational brute force and then eliminate the duplicated VAR models.

My idea was close to yours, as follows:

Code: Select all

string models=@wlookup("var*", "var") for !k=1 to @wcount(models) string z{!k}=@word(models,{!k}) next for !k=1 to @wcount(models) string z{!k}=@word(models,{!k}) next for !k=1 to @wcount(models) for !j=1 to @wcount(models) if {!k}<>{!j} then string a{!k}=@wnotin(z{!k}, z{!j}) endif next next


But is difficult to identify the duplicated models in this way.

Is there any command to do the opposite of @wnoint, i.e., to return the elements of one string that are in another one? Might this be a feasible way?
Thank you.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Delete duplicated VAR models

Postby EViews Gareth » Thu Dec 10, 2015 9:51 am

wintersect


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests