can we check existance of fixed effects?

For questions regarding programming in the EViews programming language.

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

Ravi
Posts: 11
Joined: Fri Apr 29, 2011 6:22 am

can we check existance of fixed effects?

Postby Ravi » Wed May 04, 2011 9:50 am

I am trying to extract fixed effects associated with all the existing equation objects in my workfile

Code: Select all

equations = app.Lookup("*","equation",1) For Each equation In equations command = "freeze(mode=overwrite,script_temp_fe) " & equation & ".effects" app.Run(command) command = "script_temp_fe.save " & output & "\\Effects\\" & equation & ".effects" app.Run(command) next
this works fine if all by equations have fixed effects
but if one of them does not then the script crashes with an error message
Equation does not contain this type of fixed or random effects
is there a way by which I can check if any kind of effects exist with the equation before executing the freeze command
OR
some way in which i can override the error message and the script continues with the next equation

-Thanks
Ravi

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

Re: can we check existance of fixed effects?

Postby EViews Gareth » Wed May 04, 2011 11:39 am

You can pull the equation's options command into a string, using the @options data member of an equation. You can then check whether those options contain the "cx=f" option.

Ravi
Posts: 11
Joined: Fri Apr 29, 2011 6:22 am

Re: can we check existance of fixed effects?

Postby Ravi » Fri May 06, 2011 1:02 am

Thanks Gareth, that was helpful.
My current working code snippet looks some thing like :

Code: Select all

temp = app.Get(equation & ".@options") If Left(temp,4) = "CX=F" then If Not objFSO.FolderExists(output & "\\Effects") Then objFSO.CreateFolder(output & "\\Effects") End If command = "freeze(mode=overwrite,script_temp_fe)" & equation & ".effects" app.Run(command) command = "script_temp_fe.save " & output & "\\Effects\\" & equation & ".effects" app.Run(command) End If

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

can we check existance of fixed effects?

Postby EViews Gareth » Fri May 06, 2011 6:58 am

That code assumes that the cx=f option is the first option, which might be fine, but in general is not safe.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: can we check existance of fixed effects?

Postby EViews Glenn » Fri May 06, 2011 11:25 am

Took me a while to figure this one out (sorry :roll: ), but it just came to me...You can use the fact that any fixed effects specified in a panel are treated as nuisance parameters and are not saved in the coefficient vector.

Suppose you have equation EQ01.

Code: Select all

!ncoefs = EQ01.@ncoefs
gives you the total number of estimated parameters including the fixed effects since those are relevant for inference.

However.

Code: Select all

!nsubcoefs = @rows(EQ01.@coef)
will give you the number of coefficients not including the nuisance parameters.

Comparing the two should give you the required info...


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests