Page 1 of 1

Dummy Variables per year

Posted: Wed Feb 10, 2010 3:32 pm
by Malkele
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.

Re: Dummy Variables per year

Posted: Wed Feb 10, 2010 3:52 pm
by EViews Gareth
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)

Re: Dummy Variables per year

Posted: Wed Feb 10, 2010 4:03 pm
by Malkele
Thank you so much for your confirmation and extra tips! It was great help! :D

Re: Dummy Variables per year

Posted: Fri Feb 26, 2010 5:57 pm
by Malkele
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!

Re: Dummy Variables per year

Posted: Fri Feb 26, 2010 8:45 pm
by EViews Gareth
You have probably fallen into the dummy variable trap so your regressors are perfectly colinear

Dummy for a specific period

Posted: Mon Mar 01, 2010 1:40 pm
by fmramos
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

Re: Dummy Variables per year

Posted: Mon Mar 01, 2010 1:52 pm
by EViews Gareth
Not really. You can use @month or @quarter to create dummies though. Something like:
series firstqdum = @quarter=1

Re: Dummy Variables per year

Posted: Mon Mar 01, 2010 3:46 pm
by EViews Chris
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...

Re: Dummy Variables per year

Posted: Mon Mar 22, 2010 9:02 am
by Farhat
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.

Re: Dummy Variables per year

Posted: Fri Feb 22, 2019 1:45 pm
by Berat
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

Re: Dummy Variables per year

Posted: Fri Feb 22, 2019 2:07 pm
by EViews Matt
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.

Re: Dummy Variables per year

Posted: Sat Feb 23, 2019 7:08 am
by Berat
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.

Re: Dummy Variables per year

Posted: Sat Feb 23, 2019 8:16 am
by EViews Matt
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.