Creating a Panel with X observations
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Creating a Panel with X observations
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!
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!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Creating a Panel with X observations
Code: Select all
!x = @round(@elem(observations,"2011"))
pagecreate(wf=Example, page=Panel) a 2011 2030 !x
Re: Creating a Panel with X observations
Works perfectly, thanks!
From a theoretical perspective, though, why doesn't putting the @elem directly in there work?
From a theoretical perspective, though, why doesn't putting the @elem directly in there work?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Creating a Panel with X observations
The pagecreate command doesn't accept expressions.
Re: Creating a Panel with X observations
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
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
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Creating a Panel with X observations
I don't really understand the question, but to set the sample to be a specific cross-section (or set of), you can use:
etc...
Code: Select all
smpl if @crossid = 3 or @crossid = 4
Re: Creating a Panel with X observations
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!
Thanks!
-
jasonrobards
- Posts: 3
- Joined: Mon Nov 12, 2012 7:33 pm
Re: Creating a Panel with X observations
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.
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.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Creating a Panel with X observations
@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"
-
jasonrobards
- Posts: 3
- Joined: Mon Nov 12, 2012 7:33 pm
Re: Creating a Panel with X observations
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"
Ex:
"smpl if dum_northamerica=1"
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Creating a Panel with X observations
No, I'd probably just do:
Code: Select all
Smpl if country="USA" or country="Canada"
Who is online
Users browsing this forum: No registered users and 1 guest
