Page 1 of 1

Creating a Panel with X observations

Posted: Mon Nov 12, 2012 7:22 am
by jason_ll
Hello,
I'm trying to create a panel with a certain number of observations equal to a number in my series.

Specifically, I am trying:

pagecreate(wf=Example, page=Panel) a 2011 2030 @round(@elem(observations,"2011"))

where observations is a series that's equal to 35000 in 2011.

But instead of getting a panel with 35,000 observations, I am getting a panel with only 20 observations (which is equal to the number of observations of the active workpage).

I tried different things, but they don't seem to work. Any way to do this?

PS: My goal is to create a program for microsimulations. But the number of people in the population is set endogenously and stored in the "observations" series.

Thanks!

Re: Creating a Panel with X observations

Posted: Mon Nov 12, 2012 8:48 am
by EViews Gareth

Code: Select all

!x = @round(@elem(observations,"2011")) pagecreate(wf=Example, page=Panel) a 2011 2030 !x

Re: Creating a Panel with X observations

Posted: Mon Nov 12, 2012 8:53 am
by jason_ll
Works perfectly, thanks!
From a theoretical perspective, though, why doesn't putting the @elem directly in there work?

Re: Creating a Panel with X observations

Posted: Mon Nov 12, 2012 8:56 am
by EViews Gareth
The pagecreate command doesn't accept expressions.

Re: Creating a Panel with X observations

Posted: Wed Nov 21, 2012 8:52 am
by jason_ll
Thanks. Any thoughts about the most efficient way to go about creating microsimulations?

I guess one way is to create pool estimations: create series person1 to person1000, age1 to age1000, education1 to education1000....

But I'm wondering if there's a more efficient way.

For example, in a balanced panel workfile, how can I restrict my sample to a given number of cross-sections (people)?

Let's say that 1,000 in my sample are aged 25. How do I go about creating a variable, "age", that is equal to 25 only for this subsample?

Any thoughts/insights would be tremendously appreciated.

jason

Re: Creating a Panel with X observations

Posted: Wed Nov 21, 2012 9:28 am
by EViews Gareth
I don't really understand the question, but to set the sample to be a specific cross-section (or set of), you can use:

Code: Select all

smpl if @crossid = 3 or @crossid = 4
etc...

Re: Creating a Panel with X observations

Posted: Wed Nov 21, 2012 11:00 am
by jason_ll
Awesome. I didn't realize you could use smpl to restrict cross-sections (just time). I am new to this and have a lot to learn...

Thanks!

Re: Creating a Panel with X observations

Posted: Thu Nov 22, 2012 12:33 pm
by jasonrobards
Is there a way to restrict the sample in panel data by cross section identifiers in string form, instead of numerical form?

Ex, something like:
smpl if @crossid = "US" or @crossid = "Canada"

instead of
smpl if @crossid = 1 or @crossid = 2

My crossids are all text based and I want to avoid recoding them as #s, if possible. Current attempts have failed (ex: "Error in Sample: Numeric operator applied to string data" when I try the proposed method above.)

Much obliged.

Re: Creating a Panel with X observations

Posted: Thu Nov 22, 2012 12:44 pm
by EViews Gareth
@crossid is never a string. It is always a number that runs from 1 to N. If you have another series that you are using as a cross-section identifier, you can use that in the sample:

Code: Select all

smpl if country = "US" or country = "Canada"

Re: Creating a Panel with X observations

Posted: Thu Nov 22, 2012 12:51 pm
by jasonrobards
Thanks. So I guess the best way to limit the panel sample is to create dummies for each x-section and then limit the sample to instances when that dummy = 1?
Ex:
"smpl if dum_northamerica=1"

Re: Creating a Panel with X observations

Posted: Thu Nov 22, 2012 1:26 pm
by EViews Gareth
No, I'd probably just do:

Code: Select all

Smpl if country="USA" or country="Canada"