Statalist


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

st: R: selecting random matched controls: survival


From   "Carlo Lazzaro" <[email protected]>
To   <[email protected]>
Subject   st: R: selecting random matched controls: survival
Date   Tue, 25 Dec 2007 18:45:37 +0100

Dear Michael,

I do not actually know whether a Stata routine is available for random
selecting matched controls (MCs).
I have tried to replicate your research track in Comp1.dta (please see Stata
commands below, concerning your ID 1 patient). I suppose you have to set up
a separate data set (Comp2.dta) for controls (i.e., tx==0) and invoke the
next steps of the procedure each time you need to select two random MCs.
I do hope that some Stata guru on the list can provide you with a more
efficient trick to work around this hurdle.
--------------- begin example----------------------------
save "C:\Comp1.dta"
save "C:\Comp2.dta"
use "C:\Comp2.dta", clear
drop if tx==1
(2 observations deleted)
drop if  _t<=.4
(1 observation deleted) 
sample 2 if  _t>=.4, count
--------------- end example----------------------------

Kind Regards and I reciprocate All the Best for the current Season's
Holidays,

Carlo
-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di Michael McCulloch
Inviato: luned� 24 dicembre 2007 20.12
A: Statalist
Oggetto: st: selecting random matched controls: survival

Dear Statalist members,

I would like to ask help in a routine for selecting random matched 
controls in a survival dataset.

I have patients (tx=1) and controls (tx=0), and have _stset_.
Time from diagnosis to death = _t.
In the patients, I also know the time between diagnosis and treatment 
(leadtime).

I wish to randomly select two controls per patient, from among all 
controls who have survived at least as long as the leadtime for that 
patient. For example, subject ID==1 has eligible controls:
	ID==12 | ID==13 | ID==14
Therefore, I'd like to randomly select two controls from among those 
three eligible controls.

ID	tx	_t	leadtime
1	1	1.0	0.4
2	1	1.2	0.3
11	0	0.1
12	0	0.9
13	0	1.1
14	0	0.5

May I ask how this can be done in a do-file or small program?

Happy Holidays to all,

-- 

Michael McCulloch
Pine Street Foundation
124 Pine St., San Anselmo, CA 94960-2674
Tel:	(415) 407-1357
Fax:	(415) 485-1065
[email protected]
www.pinestreetfoundation.org
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index