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: preserve-restore


From   Steve Samuels <sjsamuels@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: preserve-restore
Date   Thu, 14 Oct 2010 10:37:56 -0400

Grethe Søndergaard:

Perhaps you need to rethink your problem. . You want  Cox strata for
1) maternal siblings: 2) paternal siblings.  For a Cox analysis, each
subject can appear in only one stratum at a time point. (For
time-dependent strata, switching is possibe.)  What will you do with
child 1 in the data below?

child mother father
1        1         1
2        1         2
3        2         1

A suggestion:  Work out your analysis setup on a small data set (n = 10)


Steve

Steven J. Samuels
sjsamuels@gmail.com
18 Cantine's Island
Saugerties NY 12477
USA
Voice: 845-246-0774
Fax:    206-202-4783



On Thu, Oct 14, 2010 at 2:16 AM, Grethe Søndergaard
<dkstatstata@gmail.com> wrote:
> Dear Statalist
>
> For some reason, the layout of the e-mail I sent to you a couple of
> days ago was quite messy, since a lot of symbols had sneaked into it
> after sending it. Therefore I am sending it again:
>
> I have a couple of questions about the preserve-restore procedure and stset.
>
> My dataset:
> id father-id mother-id death var ...
> 1 1 10 0 1
> 2 1 10 1 1
> 3 1 20 1 1
> 4 1 20 0 1
> 5 2 10 1 1
> 6 2 10 0 1
> 7 3 30 0 1
> 8 3 30 1 1
> ...
> save \Temp\hs.dta", replace
>
>
> I want to compare all maternal half siblings within a family as well
> as all paternal siblings within a family. In order to do this, I start
> out by creating an id-variable for full siblings, paternal half
> siblings or maternal half siblings and afterwards I run preserve-restore:
>
> egen gruppe = group(father-id mother-id)
> egen mgr = group(mother-id)
> egen fgr = group(father-id)
>
>
> forvalues x = 1/8{
> preserve
>
> *MATERNAL HALF SIBLINGS*
> gen strata_mother = `x' if ((mgr==mgr[`x']) & gruppe != gruppe[`x']) |_n==`x'
>
> *PATERNAL HALF SIBLINGS*
> gen strata_father = `x' if ((fgr==fgr[`x']) & gruppe != gruppe[`x']) | _n==`x'
>
> drop if strata_mother==. & strata_father==.
>
> if `x' == 1 {
> save " \Temp\hs.dta", replace
> }
> else {
> append using " \Temp\hs.dta"
> save " \Temp\hs.dta", replace
> }
> restore
> }
>
> I have the following questions:
> 1. Is there any way to make preserve-restore run faster (my dataset
> contains more than 2 mil. observations so it takes about two days to
> run it)
> 2. Is it problematic to create strata_father after creating
> strata_mother in the same preserve-restore statement?
> 3. I want to use strata_father and strata_mother as strata
> variables in a cox regression analysis - and I want to perform the
> analyses separately for females and males. Since preserve-restore runs
> slowly, I want to state this after having run it. However, it seems as
> if it doesnt work to state that I only want to include e.g. males in
> stset (if sex==M). Males who experience an event,
> but who has no brothers but a half sister still counts as an
> event. Is there any way to state in stset, that I only want to compare
> males and that I only want to include events, if the male who
> experience it has one or more brothers?
>
> I hope this is clear but since I am not an experienced user of
> Stata, please let me know if you need more details.
>
> Thank you
>
> Grethe
> *
> *   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