Panel or Pool?
Moderators: EViews Gareth, EViews Moderator
-
pschneider
- Posts: 11
- Joined: Wed Jul 10, 2019 6:57 am
Re: Panel or Pool?
ok great, sent to Gareth.Thomas@ihsmarkit.com
-
Muhammad Khurram
- Posts: 10
- Joined: Thu Apr 28, 2022 4:28 pm
Re: Panel or Pool?
Really helpful and well explained, thank you team Eviews.
-
dagfinnrime
- Posts: 54
- Joined: Sat Oct 11, 2008 9:37 am
- Location: Oslo
- Contact:
Re: Panel or Pool?
Problem generating av variable as share of a different cross-section!
I have a panel where one of the cross-sections is actually the sum of the others. My cross-sections have names but I have made a variable with names replaced with numbers, and the cross-x that is aggregate is number 1.
In panel: I do
volume/@sumsby(volume, @obsid, cxid=1,"29/10/2012 5/06/2015")
Result:
CXID Mean Std. Dev. Obs.
1 1.000000 0.000000 673
2 0.360038 0.169855 672
3 0.028747 0.045342 670
4 0.268701 0.144842 673
5 0.259850 0.168693 673
6 0.083576 0.110940 671
All 0.333829 0.342279 4032
As expected: for CXID=1 the mean=1 and no std.Dev.
I have created a pool-sheet for the same data. I create similar shares from the series:
VOLUME_1/VOLUME_1 VOLUME_2/VOLUME_1 VOLUME_3/VOLUME_1 VOLUME_4/VOLUME_1 VOLUME_5/VOLUME_1 VOLUME_6/VOLUME_1
Mean 1.000000 0.321767 0.021122 0.242661 0.234802 0.061333
Std. Dev. 0.000000 0.128300 0.029529 0.128632 0.150955 0.065457
Observations 673 672 670 673 673 671
Number of observations are the same, and averages and std.dev are ball-park the same, but not exactly the same.
Why not? What am I doing wrong?
* I did the @sumsby also with @date, but I guess that is not as good as @obsid (for reasons I don't really understand)
Thanks in advance,
Dagfinn
I have a panel where one of the cross-sections is actually the sum of the others. My cross-sections have names but I have made a variable with names replaced with numbers, and the cross-x that is aggregate is number 1.
In panel: I do
volume/@sumsby(volume, @obsid, cxid=1,"29/10/2012 5/06/2015")
Result:
CXID Mean Std. Dev. Obs.
1 1.000000 0.000000 673
2 0.360038 0.169855 672
3 0.028747 0.045342 670
4 0.268701 0.144842 673
5 0.259850 0.168693 673
6 0.083576 0.110940 671
All 0.333829 0.342279 4032
As expected: for CXID=1 the mean=1 and no std.Dev.
I have created a pool-sheet for the same data. I create similar shares from the series:
VOLUME_1/VOLUME_1 VOLUME_2/VOLUME_1 VOLUME_3/VOLUME_1 VOLUME_4/VOLUME_1 VOLUME_5/VOLUME_1 VOLUME_6/VOLUME_1
Mean 1.000000 0.321767 0.021122 0.242661 0.234802 0.061333
Std. Dev. 0.000000 0.128300 0.029529 0.128632 0.150955 0.065457
Observations 673 672 670 673 673 671
Number of observations are the same, and averages and std.dev are ball-park the same, but not exactly the same.
Why not? What am I doing wrong?
* I did the @sumsby also with @date, but I guess that is not as good as @obsid (for reasons I don't really understand)
Thanks in advance,
Dagfinn
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13583
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Panel or Pool?
Could you provide an example workfile?
-
dagfinnrime
- Posts: 54
- Joined: Sat Oct 11, 2008 9:37 am
- Location: Oslo
- Contact:
Re: Panel or Pool?
Hei,
please find attached an example file. Two sheets, Panel and pool. Pool created from panel by unstack in new page. I have 6 categories in the panel, where category 1 is "all". (all is actually slightly larger than sum of group 2-6 because one group is omitted here).
I want to learn each groups share of the total (all).
In panel I create an object from "show volume/@sumsby(volume,@obsid,crossid=1,"29/10/2012 5/06/2015")" and use "Descriptive stats by classification".
In Pool-sheet I simply create a group where all volume-series are divided by the first volume-series.
Look forward to solution :-)
Dagfinn
please find attached an example file. Two sheets, Panel and pool. Pool created from panel by unstack in new page. I have 6 categories in the panel, where category 1 is "all". (all is actually slightly larger than sum of group 2-6 because one group is omitted here).
I want to learn each groups share of the total (all).
In panel I create an object from "show volume/@sumsby(volume,@obsid,crossid=1,"29/10/2012 5/06/2015")" and use "Descriptive stats by classification".
In Pool-sheet I simply create a group where all volume-series are divided by the first volume-series.
Look forward to solution :-)
Dagfinn
- Attachments
-
- example.wf1
- (225.31 KiB) Downloaded 453 times
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13583
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Panel or Pool?
The unbalancedness of the panel means that the @sumsby function isn't quite doing what you think. If you, on the panel page, type:
and then toggle to only show observations for the current sample, you'll notice that the values of that denominator are different across different crossids, based on the number of observations in that cross id.
Code: Select all
smpl @first @first+2
show @sumsby(volume, @obsid, crossid=1)
-
dagfinnrime
- Posts: 54
- Joined: Sat Oct 11, 2008 9:37 am
- Location: Oslo
- Contact:
Re: Panel or Pool?
Thanks
so with an unbalanced panel I rather do this in pool/unstacked page, or create a ALL-variable that is same for all cross-sections in the PANEL.
Dagfinn
so with an unbalanced panel I rather do this in pool/unstacked page, or create a ALL-variable that is same for all cross-sections in the PANEL.
Dagfinn
-
dagfinnrime
- Posts: 54
- Joined: Sat Oct 11, 2008 9:37 am
- Location: Oslo
- Contact:
Re: Panel or Pool?
Hi,
How can I create a variable in an unbalanced panel that for every crossid/date equals the value for, e.g., the first crossid on that date?
I can unstack the panel-variable in a new sheet, take the first of these unstacked variables, and copy it back into the panel.
but if my crossids in the panel eg. are names it can be difficult to easily unstack them (because names with space not easily becomes variable names) so it would be easier to just do it within the panel (I have to change the names into eg numbers, and how do I do that easily?)
Dagfinn
How can I create a variable in an unbalanced panel that for every crossid/date equals the value for, e.g., the first crossid on that date?
I can unstack the panel-variable in a new sheet, take the first of these unstacked variables, and copy it back into the panel.
but if my crossids in the panel eg. are names it can be difficult to easily unstack them (because names with space not easily becomes variable names) so it would be easier to just do it within the panel (I have to change the names into eg numbers, and how do I do that easily?)
Dagfinn
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13583
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Panel or Pool?
Create a series equal to what you had before:
Code: Select all
series denom = @sumsby(volume, @obsid, "if crossid=1")
-
dagfinnrime
- Posts: 54
- Joined: Sat Oct 11, 2008 9:37 am
- Location: Oslo
- Contact:
Re: Panel or Pool?
Very sorry, but I don't get this!
* I have an unbalanced panel
* the first cross-section is the sum of the others
I want to create a variable that doesn't vary across cross-sections (is the same for each cross section for same date) based on the first cross-section id.
Let this variable be "volume".
The following works:
A)
* Create a new page by frequency and copy volume to this page using source sample and sum.
Panel covariance on the panel page reveal that this has same values for all cross-sections at same date.
B)
* Unstack panel-page in new page and copy series for first cross-section back to panel (rename to Volume_all4 first ...)
Again, panel covariance show that this is same across all cross sections at same date.
The suggested solution for doing it within the panel doesn't work.
Panel covariance show that this is not the same across all cross-sections, and it's naturally not perfectly correlated with e.g Volume_all4.
I can do procedure A or B, it's not that many lines, but prefer the correct panel version.
Best,
Dagfinn
* I have an unbalanced panel
* the first cross-section is the sum of the others
I want to create a variable that doesn't vary across cross-sections (is the same for each cross section for same date) based on the first cross-section id.
Let this variable be "volume".
The following works:
A)
* Create a new page by frequency and copy volume to this page using source sample and sum.
Code: Select all
copy(smpl="@all if cat2="all"", c=sum) v10_bypartic_cat\VOLUME *_all3 @src @date @dest @date
copy Untitled\VOLUME_ALL3 *
B)
* Unstack panel-page in new page and copy series for first cross-section back to panel (rename to Volume_all4 first ...)
Code: Select all
pageunstack(namepat=*_?) cat2 date @ volume
VOLUME_ALL.rename volume_all4
pageselect Fix_metrics_all_gbpusd_v10_bypartic_cat
copy Untitled4\VOLUME_ALL4 *
The suggested solution for doing it within the panel doesn't work.
Code: Select all
series volume_all5 = @sumsby(volume, @obsid, "if cat=""all""")
I can do procedure A or B, it's not that many lines, but prefer the correct panel version.
Best,
Dagfinn
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13583
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Panel or Pool?
You're right. The @by functions don't work as I expected. I've thought about if for a bit, and can't think of a function that will get what you want in one line :/
Return to “General Information and Tips and Tricks”
Who is online
Users browsing this forum: No registered users and 1 guest
