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.

Re: st: R: Survival Data - Compare hazards by matching on age (flag: Stata 9.2/SE)

 From asb stata To statalist@hsphsun2.harvard.edu Subject Re: st: R: Survival Data - Compare hazards by matching on age (flag: Stata 9.2/SE) Date Tue, 9 Mar 2010 14:30:51 -0500

```Carlo,

I think the trick is to compare survivors of the same age across the two
groups. Let me explain:

In group 1, subjects are sure to survive till a certain age unlike in group
2 where they are at risk since age 1. Suppose there are 100 subjects in
group 1 and they all survive till age 3 and then some, say ten, come under
risk and five die and 95 go on to age 4. Suppose there are another 100 in
group 2 and they start dying right away and only 50 survive at the beginning
of age 3 and another 10 die and 40 go on to age 4. Among survivors of age 3
across the two groups, 95% survive in group 1 (95 survive among 100) and 80%
survive in group 2 (40 survive among 50). I want to plot these percentages
of survivors at each age for the two groups. The data is in
multiple-records-per-subject format as shown below. The important variable
is flag which identifies when a subject in group 1 becomes at risk.
Subject id=1 is not at risk until period 2. I need to know how to stset and
also how to sts graph. Something like:

stset age, id(id) failure(died=1)

sts graph, by(group) ........?

asb
On Tue, Mar 9, 2010 at 11:25 AM, Carlo Lazzaro <carlo.lazzaro@tin.it> wrote:

> Asb stata wrote:
> "I want to compare the hazard of exit for the two
> groups by comparing subjects of the same age across groups. How do I do it
> in stata?"
>
> The following:
> - sts test group, logrank strata(age) -
>
> may do the trick.
>
> Kind Regards,
> Carlo
>
> -----Messaggio originale-----
> Da: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di asb stata
> Inviato: martedě 9 marzo 2010 8.02
> A: statalist@hsphsun2.harvard.edu
> Oggetto: st: Survival Data - Compare hazards by matching on age
>
> There are two groups of subjects in my data. In the first group, all
> subjects are at risk of dying since age 1. In the second group, each
> subject
> becomes at risk of dying from a subject-specific age different from 1. I
> want to stset the data properly and graph Kaplan-Meier survival curves for
> the two groups. A sample of data is presented below. id is unique subject
> id. group is 1 if subjects do not become at risk of dying until flag=1.
> Subject 1 becomes at risk of dying only at age 2 or after unlike subjects 3
> and 4 which become at risk of dying at age 1. died indicates the actual
> failure event. The data is set as multiple-record-per-subject. I do not
> want
> to compare the hazard of exit of the two groups without taking into account
> the fact that the members of the first group do not become at risk until a
> certain (variable) age. I want to compare the hazard of exit for the two
> groups by comparing subjects of the same age across groups. How do I do it
> in stata? How to match subjects by age and compare hazard of exit? Is there
> another way besides matching on age?
>
> id        group        flag        age        died
> 1           1             0            1            0
> 1           1             1            2            0
> 1           1             1            3            0
> 1           1             1            4            1
> 2           1             0            1            0
> 2           1             0            2            0
>  2           1             0            3            0
> 2           1             0            4            0
>  2           1             1            5            0
> 2           1             1            6            1
> 3           2             1            1            0
> 3           2             1            2            0
> 3           2             1            3            1
> 4           2             1            1            0
> 4           2             1            2            0
> 4           2             1            3            0
> 4           2             1            4            0
> 4           2             1            5            1
>
> *
> *   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/```