Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Getting a random sample from panel data


From   "Ben Jann" <ben.jann@soz.gess.ethz.ch>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Getting a random sample from panel data
Date   Thu, 11 May 2006 11:10:45 +0200

I was going to write that you could download -gsample- from 
the SSC archive and then type

 . gsample 10, percent wor cluster(lpnr)

but then I detected that -percent- cannot be used together 
with the -cluster()- option. I fixed the bug but you will have 
to wait until the package has been updated on SSC. Meanwhile,
a workaround would be

 . duplicates report lpnr
 . local n = round(r(unique_value) * 0.1)
 . gsample `n', wor cluster(lpnr) 

[-wor- causes sampling without replacement.]

ben

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Christer Thrane
> Sent: Wednesday, May 10, 2006 7:43 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Getting a random sample from panel data
> 
> Hi,
> 
> In my panel data (one observation per year), the variable lpnr
identifies
> persons and the variable aar identifies panels.
> 
> I wish to obtain a 10% probability sample that is representative in
terms
> of
> persons (lpnr). But if the person is selected, I want to follow him or
her
> throughout the panels (aar).
> 
> Findit "random sample" did not help me, though.
> 
> Any help is appriciated.
> 
> Best regards,
> 
> Christer Thrane
> Lillehammer University College
> Norway
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index