Is there an @elem() commmand for panel data?
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
Is there an @elem() commmand for panel data?
Is there an @elem() commmand for panel data? Something like @elem(PX, * - 2006) that would return the 2006 value of PX for the UK when the computations were for the UK (one of the panel cross-sections) but use the 2006 value of PX for Spain (another) when the computations are for Spain? I use EViews 7.1, latest update. Thanks.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Is there an @elem() commmand for panel data?
No, although you can always set the sample equal to the observation you want, and then take the maximum of the series (the max of a single number is just that number):
Code: Select all
smpl 2006 2006 if country = "UK"
!value = @max(px)
Re: Is there an @elem() commmand for panel data?
Thanks.
In terms of future EViews development, it would be useful to have such a command. Not infrequently we want to use indexes formed by, say, taking PX/@elem(PX,2002) for a standard time series. For panel data, I switch to a spreadsheet program for my computations. It would be nice to be able to just stay in EViews.
In terms of future EViews development, it would be useful to have such a command. Not infrequently we want to use indexes formed by, say, taking PX/@elem(PX,2002) for a standard time series. For panel data, I switch to a spreadsheet program for my computations. It would be nice to be able to just stay in EViews.
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Is there an @elem() commmand for panel data?
Thanks for the suggestion. A couple of things.
First, your proposed syntax is interesting. One issue is that one could conceivably want the alternate definition of your @elem in which we return the cross-section value for the given year, as in
PX/@elem(PX,"UK")
That's all fine, but now the issue comes as to how to disambiguate the two approaches. One idea is to use @elem in the fashion that you suggested, and to add an @elemc or some other such function which returns the others. We'll give this some more thought.
One of the reasons we haven't added the particular function is that most things that we can think of can be done with little effort using current EViews tools. Note that you can (relatively) easily generate your indices in EViews. Expanding on Gareth's suggestion, first, you need to generate a series which has the 1996 values for each cross-section matched to each observation in a cross section. Once you have that, you can compute your index in the natural way:
You can combine this into a single statement if you'd like
You can wrap this in a subroutine if you wish, and even design an add-in to handle the front end input so that all you'd have to enter is the series name and the year/date.
Hope this helps. Thanks again for the suggestion.
First, your proposed syntax is interesting. One issue is that one could conceivably want the alternate definition of your @elem in which we return the cross-section value for the given year, as in
PX/@elem(PX,"UK")
That's all fine, but now the issue comes as to how to disambiguate the two approaches. One idea is to use @elem in the fashion that you suggested, and to add an @elemc or some other such function which returns the others. We'll give this some more thought.
One of the reasons we haven't added the particular function is that most things that we can think of can be done with little effort using current EViews tools. Note that you can (relatively) easily generate your indices in EViews. Expanding on Gareth's suggestion, first, you need to generate a series which has the 1996 values for each cross-section matched to each observation in a cross section. Once you have that, you can compute your index in the natural way:
Code: Select all
series pxscale = @maxsby(PX, @crossid, "1996 1996")
series PX1 = PX / pxscale
Code: Select all
series PX1 = PX / @maxsby(PX, @crossid, "1996 1996")
Hope this helps. Thanks again for the suggestion.
Re: Is there an @elem() commmand for panel data?
Following up on your suggestion. I would like to create an index relative to the date variables of an element in the panel. For example, a series GDP relative to the GDP of the United States for each year. Something like
"series y = 100*gdp/@(gdp, countrycode="USA", 1950 2000)."
This command would generate a series for US with "100" for all dates. For the other countries, it would generate GDP relative to the US for each year in the panel. How to do this?
"series y = 100*gdp/@(gdp, countrycode="USA", 1950 2000)."
This command would generate a series for US with "100" for all dates. For the other countries, it would generate GDP relative to the US for each year in the panel. How to do this?
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Is there an @elem() commmand for panel data?
I think this will work (but you should double-check). The denominator computes the sums-by-year for GDP, but only for the specified country so that you'll get just the GDP for the US in each year
Code: Select all
series y = 100*gdp/@sumsby(gdp, year, "@all if countrycode=""USA""")Re: Is there an @elem() commmand for panel data?
Yes! thank you.
I think this will work (but you should double-check). The denominator computes the sums-by-year for GDP, but only for the specified country so that you'll get just the GDP for the US in each yearCode: Select all
series y = 100*gdp/@sumsby(gdp, year, "@all if countrycode=""USA""")
Who is online
Users browsing this forum: No registered users and 2 guests
