coefficient covariance matrix change to WHITE

For questions regarding programming in the EViews programming language.

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

wuruonan
Posts: 6
Joined: Tue Jun 01, 2010 2:18 am

coefficient covariance matrix change to WHITE

Postby wuruonan » Tue Jun 15, 2010 12:58 am

Hey Guys
I need your help!!
I have run over 1000 regressions with coefficient covariance matrix under "estimation default", I can change each equation to "white" one by one
but I would like to use a programme which can choose all the equations and allow me to change all the equation to "white"

I just start learning programming, I have the the following programme which will allow me to put selection names, but I don't know how to define and select all the equations, the next part will allow me to choose white for the equation, but I don't have the middle part, would you able to help me on how to select all the equations, thank you sososososo much!!!


%eqname = "e*"
scalar ret = @uiedit(%eqname, "Enter a list of equations, use * to select all equations")

!choice = 2
!doDF = 1
%list = "Default White HAC"
scalar ret = @uidialog("caption", "Covariance Options", "list", !choice, "Covariance method", %list, "check", !doDF, "DF-adjust")

Image

In the pic, I want to select all the fr_ equations and change to White heteroskedasticity-consistent standard errors & covariance, currenly all under esimation default.

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

Re: coefficient covariance matrix change to WHITE

Postby EViews Gareth » Tue Jun 15, 2010 8:16 am

At the end of your current program you will have a list of potential equation names in the variable %eqnames. You can then loop through those equations and re-estimate them one at a time with White standard errors:

Code: Select all

if @instr(%eqnames,*) then %eqnames = @wlookup(%eqnames,"Equation") 'this code handles the wildcard in %eqnames endif for !i=1 to @wcount(%eqnames) 'now we loop through the equations %currenteq = @word(%eqnames) 'get the name of the current equation {%currenteq}.ls(cov=white) 're-estimate current equation next
You can look up the LS proc in the Equation section of the Object Reference to find other estimation options.

wuruonan
Posts: 6
Joined: Tue Jun 01, 2010 2:18 am

Re: coefficient covariance matrix change to WHITE

Postby wuruonan » Wed Jun 16, 2010 12:02 am

sorry to bother you again, in this case, if I run programme like this
---------------------------------------------------------------------------------------------------------------
%eqname = "e*"
scalar ret = @uiedit(%eqname, "Enter a list of equations, use * to select all equations")
if @instr(%eqnames,*) then
%eqnames = @wlookup(%eqnames,"Equation")
endif
for !i=1 to @wcount(%eqname)
%currenteq = @word(%eqname)
{%currenteq}.ls(cov=white)
next
--------------------------------------------------------------------------------------------------------------------
I will be able to select all the equations I needed and once I have selected, all the euqations will re-estimate under white, right?


when I'm running the programme, it comes as error

error message
syntax error in "if @instr("",*)then"

I'm not very sure which one do I need to change, please advice, thank you very much for your help...

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

Re: coefficient covariance matrix change to WHITE

Postby EViews Gareth » Wed Jun 16, 2010 8:13 am

sorry, my mistake.

It should be @instr(%eqnames,"*")

wuruonan
Posts: 6
Joined: Tue Jun 01, 2010 2:18 am

Re: coefficient covariance matrix change to WHITE

Postby wuruonan » Wed Jun 16, 2010 9:36 pm

Hi Gareth


sorry to bother you again,
if I apply this programme
----------------------------------------------------------------------------------------------------------
%eqnames = "e*"
scalar ret = @uiedit(%eqnames, "Enter a list of equations, use * to select all equations")
if @instr(%eqnames,"*") then
%eqnames = @wlookup(%eqnames,"Equation")
endif
for !i=1 to @wcount(%eqnames)
%currenteq = @word(%eqnames)
{%currenteq}.ls(cov=white)
next
-----------------------------------------------------------------------------------------------------------

just there is another error message

incorrect number of arguments in %currenteq = @word("fr*")"

I try to change the programme, but still can't get the white test, please advice on the attached file, if I can change all the euquations to white test and change back by the programme. thank you so so so much.
Attachments
france.WF1
(1.3 MiB) Downloaded 448 times

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

Re: coefficient covariance matrix change to WHITE

Postby EViews Gareth » Wed Jun 16, 2010 10:42 pm

%currenteq = @word(%eqnames,!i)

wuruonan
Posts: 6
Joined: Tue Jun 01, 2010 2:18 am

Re: coefficient covariance matrix change to WHITE

Postby wuruonan » Thu Jun 17, 2010 12:58 am

thank you very much for your great help, just last question

when I run the programme with below code
--------------------------------------------------------
%eqnames = "e*"
scalar ret = @uidialog("edit",%eqnames,"Enter a list of equation names", "text"," (use * as a wildcard)")
if @instr(%eqnames,"*") then
%eqnames = @wlookup(%eqnames,"Equation")
endif
for !i=1 to @wcount(%eqnames)
%currenteq = @word(%eqnames,!i)
{%currenteq}.ls(cov=white)
next
-------------------------------------------------------

it automatically exsit from Eviews7, once I re enter into the workfile, nothing has been done or changed, I don't know if it is any other problem there
would you able to have a test with the above france.wf1 ? see if it is the same problem.

also if I want to change all the euqations back to default or HAC estimate in the future checking, shall I just change this line {%currenteq}.ls(cov=white) to default or HAC, right?

thanks again.

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

Re: coefficient covariance matrix change to WHITE

Postby EViews Gareth » Thu Jun 17, 2010 8:07 am

Is your copy of EViews 7 up to date? (You can check the build date by clicking on Help->About EViews).

Yes, to re-estimate using a difference covariance structure, you can just modify that one line.

wuruonan
Posts: 6
Joined: Tue Jun 01, 2010 2:18 am

Re: coefficient covariance matrix change to WHITE

Postby wuruonan » Thu Jun 17, 2010 9:09 pm

It works perfect, thank you so so so so much for your great help....


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests