Page 1 of 2

Panel data: sample selection, cross section and period

Posted: Mon May 27, 2013 6:27 am
by mfb
When working with panel data, how can I select from the whole sample just a few cross sections and a few periods?

I tried to use the Quick/Estimate Equation/Estimation Settings/Sample box but, apparently it only allows selection of periods, not of periods and cross sections simultaneously.

Thanks

Re: Panel data: sample selection, cross section and period

Posted: Tue May 28, 2013 9:32 am
by EViews Glenn
Use a sample condition with an "IF" for the cross-sections.

Re: Panel data: sample selection, cross section and period

Posted: Sat Jul 27, 2013 5:03 pm
by mfb
Thanks for your reply. However, I noticed you had replied only today, 27-July-2013. Reason for this is that your answer is in Technical Support/Estimation whereas I had posted my query in Econometric Discussions. I was expecting an answer in Econometric Discussions, not in Estimation. Actually, I had been sort of taken aback as my query had disappeared from Econometric Discussions. I found your answer in Estimation by struck of luck. How did my query get moved from Econometric Discussions to Estimation?

Re: Panel data: sample selection, cross section and period

Posted: Sat Jul 27, 2013 5:34 pm
by EViews Gareth
It was moved.

Re: Panel data: sample selection, cross section and period

Posted: Sat Jul 27, 2013 5:56 pm
by mfb
I can well realize that now. Problem is I didn't know that happened.

Re: Panel data: sample selection, cross section and period

Posted: Tue Nov 17, 2015 9:21 am
by YK_Econ
I would have have the exact same question and just can't find an answer. Is there somewhere an answer?

Best
YK

Re: Panel data: sample selection, cross section and period

Posted: Tue Nov 17, 2015 10:27 am
by EViews Gareth
Other than the answer given in this thread?

Re: Panel data: sample selection, cross section and period

Posted: Wed Nov 18, 2015 5:52 am
by YK_Econ
at first, i cannot find this option in the estimation window.
secondly, in the sample window, it doesnt work to just put the country code ("aus" is not defined)

thirdly, there must be a simple code to choose certain countries (= cross sections). i havent figured that one out.

best
YK

Re: Panel data: sample selection, cross section and period

Posted: Wed Nov 18, 2015 7:10 am
by EViews Gareth
Use an if condition.

Re: Panel data: sample selection, cross section and period

Posted: Wed Nov 18, 2015 12:38 pm
by YK_Econ
unfortunately, I am not even aware of the basics. the @crossid doesn't want to work.

how does it look like, if i want to run the regression

equation uncon_beta.ls dlog(ypc) log(ypc) c

for 28 eu countries (aut, bel, etc.)

is it

Code: Select all

if @crossid=aut bel dnk equation uncon_beta.ls dlog(ypc) log(ypc) c
and follow up question:

i also would like to create a series with the averages of gdp from each country like

Code: Select all

series average_gdp = @mean(gdp 'here i need to tell him: from each crossid
btw. i do not have a sheet with single countries. just the panel sheet.

best
YK

Re: Panel data: sample selection, cross section and period

Posted: Wed Nov 18, 2015 12:50 pm
by EViews Gareth

Code: Select all

smpl if country="aut" or country="bel" or country="dnk"
or you can use @inlist

You can use @meansby

Re: Panel data: sample selection, cross section and period

Posted: Wed Nov 18, 2015 1:20 pm
by YK_Econ
the @meansby doesnt work. it gives me a weird list, where in the @crossid column, there are means I dont understand like [0,50] and [50,100]. these are definily not the means i am looking for.

isn't there a quick code for it?

best
YK

Re: Panel data: sample selection, cross section and period

Posted: Wed Nov 18, 2015 2:00 pm
by EViews Gareth
Did you use the @meansby function?

Re: Panel data: sample selection, cross section and period

Posted: Thu Nov 19, 2015 8:53 am
by YK_Econ
i use the @meansby function (but by following the clicking instructions of the eviews help)

is there a code for it?

Code: Select all

series gdp_average = @meansby(gdp).@crossid
something like this?

Re: Panel data: sample selection, cross section and period

Posted: Thu Nov 19, 2015 12:25 pm
by EViews Glenn

Code: Select all

series gdp_average = @meansby(gdp, @crossid)