groups in a panel

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

mariposa
Posts: 21
Joined: Tue Dec 02, 2008 7:04 am

groups in a panel

Postby mariposa » Fri Aug 28, 2009 1:39 am

Dear all,

for my current project I want to analyze groups of countries. As on the time series level I have much too less observations for the estimations I want to make (f.ex. rolling estimations of 5 year windows with annual data), I want to structure my workfile as a panel (by the way I have 50 countries, 27 years).

Now I am interested in analyzing different subgroups of the countries (my cross-section-identifiers). I am aware of that this is not the idea of a panel - but still, that is what I want to do :wink:
A pool probably would be easier, but as far as I read the forum, with 50 countries it is better to use a panel.

One idea is to make several pages with different panel (containing different subsets of countries), but I hope, that there is a more elegant way to change the composition of cross-section-identifieres in my panel!!

Can anybody help me with this??

Best regards, Mariposa

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

Re: groups in a panel

Postby EViews Gareth » Fri Aug 28, 2009 7:16 am

Just put everything in one page, then whenever you want to do something, just set the sample to be only the cross-sections you want.
Follow us on Twitter @IHSEViews

mariposa
Posts: 21
Joined: Tue Dec 02, 2008 7:04 am

Re: groups in a panel

Postby mariposa » Fri Aug 28, 2009 8:24 am

Thanks, Gareth! I already left my office, where I have my EViews-Version, so I can only try on Monday... Actually, it is the first time I use a panel workfile structure. So I guess the programming code to set the sample is similar to the time series case: sth. like

Code: Select all

smpl _usa _deu _fra
? But I will have a look at the Reference Manual Monday.

Thanks again and have a nice weekend :)
(I know in the US you have still some hours to work...)

Best regards, Mariposa

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

Re: groups in a panel

Postby EViews Gareth » Fri Aug 28, 2009 8:50 am

no, something like:

Code: Select all

smpl if crossid = "_usa" or crossid = "_deu" or crossid = "_fra"
Follow us on Twitter @IHSEViews

mariposa
Posts: 21
Joined: Tue Dec 02, 2008 7:04 am

Re: groups in a panel

Postby mariposa » Fri Aug 28, 2009 8:55 am

Thanks :)

mariposa
Posts: 21
Joined: Tue Dec 02, 2008 7:04 am

Re: groups in a panel

Postby mariposa » Tue Sep 01, 2009 7:07 am

Hi again,

I tried it, but unfortunately it does not work (so in the meantime I worked with a pool, but I think I would be really better off with a panel structured workfile). Can you give me a hint?!

I tried it also with the workfile of one of your posts (http://forums.eviews.com/viewtopic.php?f=7&t=74#p168 ):
http://www.eviews.com/Forum_support/pool2panel/poolg7.wf1, that I changed to a panel structure with:

Code: Select all

pagestack unemp?


Now, with the suggested

Code: Select all

smpl if crossid = "_can" or crossid = "_fra"
I get the error message "Error in Sample: CROSSID is not defined" :( ; thus as I think that the crosssection identifiers are stored in id01, I tried

Code: Select all

smpl if id01 = "_can" or id01 = "_fra"

But then I get the message "WARNING: Sample contains no observations." :?

What do I do wrong? What is the correct way to define the sample?

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

Re: groups in a panel

Postby EViews Gareth » Tue Sep 01, 2009 8:09 am

It's case sensitive. In that particular example, it should be:

Code: Select all

smpl if id01 = "_CAN" or id01 = "_FRA"
Follow us on Twitter @IHSEViews

mariposa
Posts: 21
Joined: Tue Dec 02, 2008 7:04 am

Re: groups in a panel

Postby mariposa » Tue Sep 01, 2009 8:12 am

oh great! thank's a lot! :D

mariposa
Posts: 21
Joined: Tue Dec 02, 2008 7:04 am

can a string variable contain quotes within quotes?

Postby mariposa » Wed Sep 02, 2009 1:39 am

Hi again,

as I want to make rolling estimations for different "subgroups" within my panel, I want to programm a loop. Therefore my string variable should support quotes within quotes (with some "hierarchical order"), what it apparently does not do. Is there any solution??

Here comes a summary of what I want to do:

Code: Select all

%kl1=" id01="_BRA" or id01="_CHN" or id01="_CZE" "
%kl2=" id01="_BEL" or id01="_DNK" or id01="_FIN" or id01="_FRA" "

for %condition {%kl1} {%kl2}

' set window size
!window = 5

' get size of workfile
!length = @obsrange

' compute stats for each window
for !i = 1  to  !length-!window+1

   smpl @first+!i-1 @first+!i+!window-2 if {%condition}
   'now the estimations etc.

next 'refering to condition


The problem is in the first part, where I define the conditions. As the part of if id01="..." already contains quotes I did not find out how to sum it up. :(

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

Re: groups in a panel

Postby EViews Gareth » Wed Sep 02, 2009 8:08 am

Make a sample object first, then use that sample object inside the loop. Something like:

Code: Select all

sample smpl1 if id01="_BRA" or id01="_CHN" or id01="_CZE"
sample smpl2 if id01="_BEL" or id01="_DNK" or id01="_FIN" or id01="_FRA"

for %condition smpl1 smpl2

smpl @first+!i-1 @first+!i+!window-2 if {%condition}
Follow us on Twitter @IHSEViews

mariposa
Posts: 21
Joined: Tue Dec 02, 2008 7:04 am

Re: groups in a panel

Postby mariposa » Wed Sep 02, 2009 8:41 am

Great, it works! Many thanks, Gareth!!

I think, I already said it several times, but as it is true, once again: I really appreciate the reliable help in this forum!! :D Without your aid, I suppose that I already would have despaired several times of my EViews programms :wink:

acsbarnabas
Posts: 4
Joined: Wed Nov 25, 2009 2:36 pm

Re: groups in a panel

Postby acsbarnabas » Wed Nov 25, 2009 2:48 pm

Dear All,
I am a first time user here, so I just hope that my query finds the right person. I have a panel database with 500 cross sections. I have 60 variables I would like to create a correlation matrix on each cross section. However I do not want to create the correlation matrix 500 times by making a sample for each cross section. Do you have an idea how I could create 500 correlation matrices for the 500 cross sections in one or a few step?
I am really grateful for your reply,
brgds,
Barnabas

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: groups in a panel

Postby startz » Wed Nov 25, 2009 5:26 pm

You're talking about 500 tables, each with about 1800 unique entries. That's close to a million numbers you want to generate. Out of curiousity, what are you going to do with a million numbers when you get them?

acsbarnabas
Posts: 4
Joined: Wed Nov 25, 2009 2:36 pm

Re: groups in a panel

Postby acsbarnabas » Thu Nov 26, 2009 2:09 am

Hi Startz:)
No, it is in one table, ordered in a Panel structure, if it makes the difference.;) Actually I am examining the relationship between stock and macro fundamentals, and by generating the correlation tables, I would like to spot high correlation "areas", which I could model later on.

In relation to this. Do I have to set sg, in order to run regression on panel data?

Thank you.
brgds,
Barni


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 64 guests