Dummy Variables per year

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

Malkele
Posts: 3
Joined: Wed Feb 10, 2010 3:00 pm

Dummy Variables per year

Postby Malkele » Wed Feb 10, 2010 3:32 pm

I'm new to eviews and I'd like some confirmation.

My dependant variable is fdi of countries and my independant variable is gdp of countries. Even though I gathered the data for each country from years dating from 95 to 02, I have assembled cross-sectional data (I took averages from all the years).

To control for the years, I wanted to create dummy variables for each year. To create annual dummy variables, do I use d95=@recode(@year=1995,1,0)?

Thanks in advance for your consideration and answers.

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

Re: Dummy Variables per year

Postby EViews Gareth » Wed Feb 10, 2010 3:52 pm

That would work, but perhaps an easier way would just be:

Code: Select all

group dummies @expand(@year)


Which would create a group full of the dummies, which you could then use in an equation object as regressors. If you don't want to include all the years, to avoid the dummy variable trap, you could do:

Code: Select all

group dummies @expand(@year,@dropfirst)
Follow us on Twitter @IHSEViews

Malkele
Posts: 3
Joined: Wed Feb 10, 2010 3:00 pm

Re: Dummy Variables per year

Postby Malkele » Wed Feb 10, 2010 4:03 pm

Thank you so much for your confirmation and extra tips! It was great help! :D

Malkele
Posts: 3
Joined: Wed Feb 10, 2010 3:00 pm

Re: Dummy Variables per year

Postby Malkele » Fri Feb 26, 2010 5:57 pm

I guess there is another concern I have... I ran a regression now with my variables plus the new annual dummy variables..and I get the message "near singular matrix". What does that mean and how can I fix it?

ls fdihost d95 d96 d97 d98 d99 d00 d01 d02 ctaxh ctaxsrc gdphost gdpsrc lang

Thanks!

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

Re: Dummy Variables per year

Postby EViews Gareth » Fri Feb 26, 2010 8:45 pm

You have probably fallen into the dummy variable trap so your regressors are perfectly colinear
Follow us on Twitter @IHSEViews

fmramos
Posts: 86
Joined: Fri Sep 19, 2008 7:30 am
Location: Sao Paulo / Brazil
Contact:

Dummy for a specific period

Postby fmramos » Mon Mar 01, 2010 1:40 pm

Good topic, good ideas for auto dummies.

I'd like to know if is it possible to get auto dummies for a selected period. For just one point, I use @isperiod("date"). Could I use something as useful for more than one period (eg. 3 or 4 consecutive months or quarters)?

Tks in advance,

Fabio

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

Re: Dummy Variables per year

Postby EViews Gareth » Mon Mar 01, 2010 1:52 pm

Not really. You can use @month or @quarter to create dummies though. Something like:
series firstqdum = @quarter=1
Follow us on Twitter @IHSEViews

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

Re: Dummy Variables per year

Postby EViews Chris » Mon Mar 01, 2010 3:46 pm

Something like this is probably close to what you're after:

Code: Select all

@expand(@trend, "1960m3 1960m8")

The labelling is probably a bit cryptic though...

Farhat
Posts: 1
Joined: Mon Mar 22, 2010 8:00 am

Re: Dummy Variables per year

Postby Farhat » Mon Mar 22, 2010 9:02 am

Malkele wrote:I guess there is another concern I have... I ran a regression now with my variables plus the new annual dummy variables..and I get the message "near singular matrix". What does that mean and how can I fix it?

ls fdihost d95 d96 d97 d98 d99 d00 d01 d02 ctaxh ctaxsrc gdphost gdpsrc lang

Thanks!

Hi Malkele,
can you plz explain me how to generate dummy variables in e-views.
thanks.

Berat
Posts: 6
Joined: Fri Dec 09, 2016 8:23 am

Re: Dummy Variables per year

Postby Berat » Fri Feb 22, 2019 1:45 pm

Hi,

I would highly appreciate some help with regard to country year dummy variable.

I am running a VAR model and i was suggested to include year dummy and country dummy variable. In addition, i was suggested to include a country-year dummy variable.

1. How i can create a country-year dummy variable?
2. Is this possible to have in one equation country dummy, year dummy and country-year dummy variable?

I would appreciate some suggestions.

Thank you

EViews Matt
EViews Developer
Posts: 387
Joined: Thu Apr 25, 2013 7:48 pm

Re: Dummy Variables per year

Postby EViews Matt » Fri Feb 22, 2019 2:07 pm

Hello,

Assuming, for example, that you have a country series named "country", you can specify a country-year dummy as @expand(country, @year). As long as you have enough observations, mathematically you can add all three types of dummies.

Berat
Posts: 6
Joined: Fri Dec 09, 2016 8:23 am

Re: Dummy Variables per year

Postby Berat » Sat Feb 23, 2019 7:08 am

Many thanks for your reply.

As I am new in EVIEWs, I might ask some basic question, sorry.

After I create the country-time dummy, I get the response of Near Singular Matrix. I suspect that this is because of the dummy variable trap. Do you have any suggestion of how I can drop one Dummy Variable (in my case one year)?

In addition, you said that mathematically is possible to have all dummies in one equation (e.g. country, year and country-year Dummy Variable), but will this cause colinearity?

Once again, thank you so much for your time.

EViews Matt
EViews Developer
Posts: 387
Joined: Thu Apr 25, 2013 7:48 pm

Re: Dummy Variables per year

Postby EViews Matt » Sat Feb 23, 2019 8:16 am

The issue likely is the dummy variable trap. Thankfully, the @expand function has an option to "drop" dummies for this very reason, e.g., @expand(country, @year, @droplast).

You're correct, a country-year dummy encompasses both a country dummy and a year dummy, so you would not be able to include both. But you should be able to include either both the country dummy and the year dummy, or just the country-year dummy. Both scenarios still need protection from the dummy variable trap.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 3 guests