Dummy Variables per year
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
Dummy Variables per year
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.
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.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables per year
That would work, but perhaps an easier way would just be:
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)
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
Re: Dummy Variables per year
Thank you so much for your confirmation and extra tips! It was great help!
Re: Dummy Variables per year
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!
ls fdihost d95 d96 d97 d98 d99 d00 d01 d02 ctaxh ctaxsrc gdphost gdpsrc lang
Thanks!
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables per year
You have probably fallen into the dummy variable trap so your regressors are perfectly colinear
Follow us on Twitter @IHSEViews
Dummy for a specific period
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
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
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables per year
Not really. You can use @month or @quarter to create dummies though. Something like:
series firstqdum = @quarter=1
series firstqdum = @quarter=1
Follow us on Twitter @IHSEViews
-
- EViews Developer
- Posts: 161
- Joined: Wed Sep 17, 2008 10:39 am
Re: Dummy Variables per year
Something like this is probably close to what you're after:
The labelling is probably a bit cryptic though...
Code: Select all
@expand(@trend, "1960m3 1960m8")
The labelling is probably a bit cryptic though...
Re: Dummy Variables per year
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
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
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 Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Dummy Variables per year
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.
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
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.
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 Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Dummy Variables per year
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.
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.
Who is online
Users browsing this forum: No registered users and 25 guests