Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: How to (almost) randomly reduce the number of observations?


From   Dimitrije Tišma <dimitrijetisma@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: How to (almost) randomly reduce the number of observations?
Date   Thu, 22 Apr 2010 12:35:09 +0200

Thanks a lot Buzz, Martin and Maarten, it worked! I apologize for the
belated feedback.

Dimitrije








2010/4/20 Buzz Burhans <buzzb3@earthlink.net>:
> Dimitrije,
> Conceptually, could you do something like this, which drops a proportion of
> the ids first, then restores all the observations for that id.  It should
> get you more closer to the proportionate reduction you want in larger
> datasets:
>
>
> program drop tabid
>
> program tabid, sortpreserve
> tabulate id
> end
>
> clear
> sysuse auto
> g id = word(make,1)
>
> count
> tabid
> preserve
> contract id
> l
> set seed 10192010
> drop if runiform()<.5
> tempfile kept
> save `kept'
> restore
> merge m:1 id using "`kept'"
> keep if _merge==3
> count
> tabid
>
>
>
> Buzz Burhans, Ph.D.
>
> Dairy-Tech Group
> So. Albany, VT / Twin Falls ID
>
> Phone: 802-755-6842
> Cell: 208-320-0829
> Fax VT: 802-755-6842
> Fax ID: 208-735-1289
>
> Email: buzzb3@earthlink.net
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Dimitrije Tišma
> Sent: Monday, April 19, 2010 2:31 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: How to (almost) randomly reduce the number of observations?
>
> Hi,
>
> I would like to ask how to reduce number of observations randomly BUT
> in a way that all observations are kept that are related to the person
> who still in the dataset. Thanks!
>
> Dimitrije
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index