Dummy Variables

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

Postby ecofin » Fri Jan 03, 2014 1:44 pm

the problem is geralized the dummy for all series for daily date no-dated and quarterly :cry: .
daily:
series dum1= @recode((@date<=@dateval("31/01/1990")) or (@date>=@dateval("01/03/1990") and @date<=@dateval("31/03/1990")) or (...etc,1,0)

No-dated:
series dum2=@recode((@obsnum<=2) or (@obsnum>=5 and @obsnum<=6) or (...etc,1,0).

quarterly:
series dum3=@recode((@date<=@dateval("1990q04")) or (@date>=@dateval("1992q01") and @date<=@dateval("1992q04")) or (...etc,1,0)

it's long to write for all date, Have you an idea.
best regards.

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

Re: Dummy Variables

Postby EViews Gareth » Fri Jan 03, 2014 5:27 pm

How many dates do you have? What's wrong with what you just wrote?
Follow us on Twitter @IHSEViews

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

Postby ecofin » Sat Jan 04, 2014 1:42 am

I have 400 obs, the problem it takes a lot of time to create dummy for large observations like my example with the function, if I have for example 1000 obs or 5000 obs :shock: what shall I do.
my example for NO-dated obs is: create dummy equal 1 for "1 2" obs next "5 6" obs next "9 10" obs next....etc, dummy equal 0 for "3 4" obs next "7 8" obs next "11 12" obs...etc, for all 400 obs.

my idea just to create regular dummy equal 1 for obs for example: 6 obs take 1 next 6 obs take 0 next 6 obs take 1...etc, you understand me.

best regards.

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

Postby ecofin » Mon Jan 06, 2014 7:31 am

is there any way to reduce the function for dummy in my example because it's very long.

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

Re: Dummy Variables

Postby EViews Glenn » Mon Jan 06, 2014 8:09 am

I'm not certain that I understand all of the details of your computation, but there is a classify proc that should do what you want. It's described in detail in the manual. On a series, click on Proc/Classify (I'm not sure of the exact proc name and I'm away from the docs right now, but you should be able to find it).

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

Postby ecofin » Mon Jan 06, 2014 10:23 am

ok I explain, just I would like to create dummy variable for my series No-dated, quarterly or monthly, daily data like this 11 00 11 00 11 00...etc or for quaterly data 1111 0000 1111 0000...etc, for monthly 12 obs take 1 and next 12 obs take 0...etc.
but the problem is very long to write it by the function like this for No-dated: series dum2=@recode((@obsnum<=2) or (@obsnum>=5 and @obsnum<=6) or (...etc,1,0), I can write it by the function for all my 400 obs, but it takes long time.
you understood me.

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

Re: Dummy Variables

Postby EViews Glenn » Mon Jan 06, 2014 12:08 pm

I think I understand, my earlier response does apply.

Proc/Generate by Classification. Method: Limit Values. Choose the appropriate bin interval definition. Encoding: Index (0, 1, 2...)

Then use the new variable with @expand.

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

Postby ecofin » Mon Jan 06, 2014 12:45 pm

this my work file, I would like to create dummy for quarterly data like this 1111 0000 1111 0000 ...etc, my series 'x', how to use @expand.
Attachments
cpi.WF1
(14.89 KiB) Downloaded 319 times

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

Postby ecofin » Tue Jan 07, 2014 1:42 am

would you like to help me, how tu use @expand for the quarterly data or No-dated...etc, just create dummy like this 1111 0000 1111 0000...etc
kind regards.
Attachments
classify.png
classify.png (23.14 KiB) Viewed 14661 times

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

Re: Dummy Variables

Postby EViews Gareth » Tue Jan 07, 2014 8:48 am

So you just want a dummy variable that has four 1s, followed by four 0s, followed by four 1s, followed by four 0s and so on?

Code: Select all

series dum=@mod(@trend,8)<4
Follow us on Twitter @IHSEViews

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

Postby ecofin » Tue Jan 07, 2014 10:02 am

thanks a lot Gareth and Glenn for your help and your reply :D .

jodai
Posts: 2
Joined: Wed Jan 08, 2014 1:15 pm

Re: Dummy Variables

Postby jodai » Wed Jan 08, 2014 1:20 pm

I have dated (yearly) panel data and want to create a dummy variable that takes 1 exclusively for the three years previous to a specific change in the data and 0 otherwise. Specifically, I have a variable that changes over time and I want the dummy variable to take 1 in the three years previous to it getting bigger than 0.2. Any help is very much appreciated. Thank you in advance.

jodai
Posts: 2
Joined: Wed Jan 08, 2014 1:15 pm

Re: Dummy Variables

Postby jodai » Wed Jan 08, 2014 2:39 pm

I did it in excel now, but I'd still be curious how it would work in eviews :)

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Dummy Variables

Postby startz » Wed Jan 08, 2014 2:43 pm

Code: Select all

series dummy = x(1)>.2 or x(2)>.2 or x(3)>.2

ariana
Posts: 1
Joined: Fri Jan 10, 2014 10:41 am

Re: Dummy Variables

Postby ariana » Thu Jan 16, 2014 5:53 am

hi
i have a question regarding to use year dummy variables in fixed effect model
when i add my dummy variable and i want to run a model it says singular matrix but without it i can use fixed effect
one more question is about using distance variable,you know that distance is not changing by time so it relates to cross section just ,but again when i want to run fixed effect it is not working,when i remove distance then it will be ok
i want to know what is the problem
thanks alot


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 22 guests