Page 1 of 1

can we check existance of fixed effects?

Posted: Wed May 04, 2011 9:50 am
by Ravi
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

Re: can we check existance of fixed effects?

Posted: Wed May 04, 2011 11:39 am
by EViews Gareth
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.

Re: can we check existance of fixed effects?

Posted: Fri May 06, 2011 1:02 am
by Ravi
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

can we check existance of fixed effects?

Posted: Fri May 06, 2011 6:58 am
by EViews Gareth
That code assumes that the cx=f option is the first option, which might be fine, but in general is not safe.

Re: can we check existance of fixed effects?

Posted: Fri May 06, 2011 11:25 am
by EViews Glenn
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...