Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: How to (almost) randomly reduce the number of observations?
From
"Buzz Burhans" <[email protected]>
To
<[email protected]>
Subject
st: RE: How to (almost) randomly reduce the number of observations?
Date
Mon, 19 Apr 2010 16:09:38 -0600
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: [email protected]
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Dimitrije Tišma
Sent: Monday, April 19, 2010 2:31 PM
To: [email protected]
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/