Choice of analysis time in survival analysis where the hazard is associated with age

134 views
Skip to first unread message

roland andersson

unread,
Dec 14, 2009, 7:41:57 AM12/14/09
to Epidem...@googlegroups.com, Terlinder John
I have a large national dataset and plan to analyse socioeconomic
differences in risk of having appendicitis. Persons born after 1949 to
end of 1990 and alive at 1/1/1991 (n=4.500.000) are included in the
dataset. The dataset contains the date when a person was operated for
appendicitis between 1/11/1990 and 31/12/2003 and date of death.

The hazard of having appendicitis is agedependent and is increasing
till age 13 and then decreasing. Previous collaborators have made
Coxregression with time from 1/11/1990 to the appendicitisdiagnosis or
censoring as analysistime, and have entered age at operation as
covariates to control for the age-dependent differencies in hazard.

Knowing that the hazard is age-dependent I think this may give biased
results. I therefore wonder if it would be better to use age as
analysis time (with late entries) instead of time from start of follow
up with adjustment for age. Am I right to think that this will be a
better way of controling for the age-dependent differences in hazard?
If that is the case may I also include age as a covariate in the
analysis or would that complicate things?

I have also considered to use a stratified analysis with ageintervals
as stratification variable. Can you give some advice on how these
ageintervals should be chosen in view of the agedependent increasing
and decreasing hazard?

I would appreciate your comments.

Roland Andersson, MD PhD

BXC (Bendix Carstensen)

unread,
Dec 14, 2009, 8:18:20 AM12/14/09
to meds...@googlegroups.com
Roland,

I am not sure what is meant by the variable "age at operation", since any variable must be defined for all persons also those not operated. If this variable is defined as age at censoring (end of follow-up or death) for persons without appendicitis, the analysis is seriously flawed. However, sometimes the terminology is used for "age at follow-up", but this is no easy thing to handle in a Cox-model with another timescale, though not impossible.

A Cox analysis with time since entry, and age AT ENTRY as covariate assumes that the age-effect is linear on tho log-hazard scale.

My advice would be to use age at follow-up (also known as "current age" or "attained age") as timescale. Thus, put entry=age at entry, exit=age at exit and event=appendicitis at exit. However if you want to expand the model by calandar time (i.e. "current date", "date of follow-up"), which I assume must be a rather interesting variable in this particular context, you will have to split the follow-up for each person in smaller intervals according to calendar time, which means that you will get a rather large dataset some 12 or 13 1-year intervals for each person, one for each of the years 1990-2003, so you may get problems handlig 45 mio. records.

A handy way round this is to split follow-up by both age and calendar time to get an even larger dataset, but the tabulate this by current age and data, which will give you a nice little table with 100 by 15 observations (by sex too?). The cases and person-years from that is just used in a Poisson-analysis, and all works smoothly and will give estimated age-specific rates and RRs by calendar time.

You can find some scribblings about this in:
´
@TechReport{Carstensen.2006b,
author = {Bendix Carstensen},
title = {Demography and epidemiology: {P}ractical use of the
{L}exis diagram in the computer age, or:
Who needs the {C}ox-model anyway?},
institution = {Department of Biostatistics, University of Copenhagen},
year = {2006},
number = {06.2},
address = {\url{http://biostat.ku.dk/reports/2006/rr-06-2.pdf}}
}

and a practical example of the application of the proposed methods in:

@Article{Carstensen.2008c,
author = {B Carstensen and JK Kristensen and P Ottosen and K Borch-Johnsen},
title = {The {D}anish {N}ational {D}iabetes {R}egister:
{T}rends in incidence, prevalence and mortality},
journal = {Diabetologia},
year = {2008},
volume = {51},
pages = {2187--2196}
}

The latter is not freely available on the net, but you can get a pdf of it from me if you mail me personally.

Best regards,
Bendix
_______________________________________________

Bendix Carstensen
Senior Statistician
Steno Diabetes Center
Niels Steensens Vej 2-4
DK-2820 Gentofte
Denmark
+45 44 43 87 38 (direct)
+45 30 75 87 38 (mobile)
b...@steno.dk http://www.biostat.ku.dk/~bxc
www.steno.dk
> --
> To post a new thread to MedStats, send email to
> MedS...@googlegroups.com .
> MedStats' home page is http://groups.google.com/group/MedStats .
> Rules: http://groups.google.com/group/MedStats/web/medstats-rules
>

roland andersson

unread,
Dec 14, 2009, 9:01:46 AM12/14/09
to meds...@googlegroups.com
Thank you Bendix

My comment in between below.

> I am not sure what is meant by the variable "age at operation", since any variable must be defined for all persons also those not operated. If this variable is defined as age at censoring (end of follow-up or death) for persons without appendicitis, the analysis is seriously flawed. However, sometimes the terminology is used for "age at follow-up", but this is no easy thing to handle in a Cox-model with another timescale, though not impossible.
>

I was uncler here. Follow up is started 1/11/1990 and end at
operation, death or censoring 31/12/2003. I use age at follow-up as
analysis time with age at 1/11/1990 as time of entry and age at the
end of follow up as time of exit. I understand that this is what you
propose as attained age. If I use attained age as analysis time can I
adjust for age at entry too?

> A Cox analysis with time since entry, and age AT ENTRY as covariate assumes that the age-effect is linear on tho log-hazard scale.
>

This is the reason why I would prefer attained age as analysis time.

> My advice would be to use age at follow-up (also known as "current age" or "attained age") as timescale. Thus, put entry=age at entry, exit=age at exit and event=appendicitis at exit. However if you want to expand the model by calandar time (i.e. "current date", "date of follow-up"), which I assume must be a rather interesting variable in this particular context, you will have to split the follow-up for each person in smaller intervals according to calendar time, which means that you will get a rather large dataset some 12 or 13 1-year intervals for each person, one for each of the years 1990-2003, so you may get problems handlig 45 mio. records.
>

I think I understand what you mean, but am not sure that I can do
this. I am using STATA and a collapsed dataset. I would need to unpack
the dataset and split according to the intervals. This would give a
too large dataset I assume. I think I do not have enough memory and am
also limited to 32-bit STATA.

> A handy way round this is to split follow-up by both age and calendar time to get an even larger dataset, but the tabulate this by current age and data, which will give you a nice little table with 100 by 15 observations (by sex too?). The cases and person-years from that is just used in a Poisson-analysis, and all works smoothly and will give estimated age-specific rates and RRs by calendar time.
>

Interesting. I would like to do this, but am not sure my combination
of hardware and software can produce this table.

BXC (Bendix Carstensen)

unread,
Dec 14, 2009, 11:07:43 AM12/14/09
to meds...@googlegroups.com
Roland,
one way forward vould be to use stsplit for say 100,000 persons at a time and then aggregate cases and personyears for these (I cannot recall the stata command that produces an aggregated dataset), this then gives you 45 tabular datasets with some 1500 (or 3000 if you tabulate by sex too) observations, and you can then make the final aggregate after putting these head-to-foot. Clumsy, but you could leave your computer at it overnight.

The next problem is the handling smooth parametric functions of age and time in Stata --- functions do exist, but I do not know how they work. Being in a register country like Denmark I use SAS which just reads and writes everything to disk. Slow in computing time (a machine), but fast in programming time (my time). Analysis of tables is then done by R, which can do analyses and graphs in finite time, thanks to the integrated matrix language. [Yes, SAS (IML) and Stata (Mata) have matrix laguages too, but no one uses them because the learning them is tantamount to learning a new programming language, and that time would be better invested in learning R]

Regards,
Bendix

raoul reulen

unread,
Dec 14, 2009, 12:34:06 PM12/14/09
to meds...@googlegroups.com
You can group the data in Stata by using the collapse command. As
Bendix suggest I would then use Poisson regression with a factor for
attained age in the model. The additional advantage of Poisson
regression over Cox is that you can evaluate the effect of attained
age as well. The disadvantage is that there might be some residual
confounding by attained age as you assume that the hazard is constant
in each age group. This is what I would do in Stata:

.stset dox, origin(dob) fail(fail==1) entry(doe) scale(365.24) id(id)
//stset using attained age as time metric (dox=date of exit; doe=
date of entry; dob=date of birth)
.stsplit ageband, at(0(5)85) //stsplit on attained age using 5 age bands
.stsplit calper, after(time=d(1/1/1900)) at(90(5)103) //stsplit on
calendar year (calper = calendar year)
.replace calper = calper + 1900
.gen pyrs = _t-_t0 //calculate person years
.collapse (sum) _d pyrs , by(ageband calper) //create grouped dataset
.xi:glm _d i.calper i.ageband , family(pois) lnoffset(pyrs) eform
//run Poisson regression with log person years as offset


I wonder whether you should calculate RRs by calendar year. Those
diagnosed in more recent years will have a shorter followup compared
to those diagnosed earlier. If the risk of the event varies with
follow-up, then what you see is not the effect of calendar year but
that of follow-up. Adjusting for attained age should get rid of most
of this confounding, but there might be some residual confounding by
follow-up. One could try to fit follow-up time and attained age both
in the Poisson model, but there is a risk of collinearity, i.e.
attained age and follow-up are highly correlated. I wonder what Bendix
thinks of this??


Hope this helps. Let me know if you have more Stata queries.

Raoul

BXC (Bendix Carstensen)

unread,
Dec 14, 2009, 12:59:43 PM12/14/09
to meds...@googlegroups.com
Raoul,

Thanks for the input. My point is however NOT to use a factor for attained age (or period for that matter). I recommend using smaller intervals for time-splitting, as an assumption of constant rates in 5-year bands is pretty blunt in most cases.

So I would do something like this (assuming that I speak Stata, which is a bit of an exaggeration...):

.stsplit ageband, at(0(1)85) // Or even: at(0(0.5)85)

.stsplit calper, after(time=d(1/1/1900)) at(90(1)103)

If you use 1 or half-year intervals you end up with 100 or 200 age-classes, so it will not make sense to enter age as a factor. Therefore you should model the age as a continuous variable by splines or fractional polynomials, using say 10 or 15 parameters. [And this is where I am really at loss in Stata].

The assumption is now instead that rates are constant in half-year intervals and that they vary smoothly by age, both of which seems pretty reasonable assumptions in most circumstances. The usual assumptions that rates are constant in 5-year classes and vary arbitrarily with age are really pretty counterintuitive. But of course defendable if you still have your i386 computer from 1984 in use and restricted to analysis of 17 by 3 tables...

Incidentally, the limiting case of using a factor model for say age in increasingly small intervals is the Cox-model. Well who would really do such a daft thing?

There are some hints as to how these proposals works in R in the course material for:
http://staff.pubhealth.ku.dk/~bxc/AdvCoh/Aalb-2008/
see slides 85 ff and the practial on Renal complications.

Best regards,
Bendix

> -----Original Message-----
> From: meds...@googlegroups.com
> [mailto:meds...@googlegroups.com] On Behalf Of raoul reulen
> Sent: 14. december 2009 18:34
> To: meds...@googlegroups.com
> Subject: Re: {MEDSTATS} Choice of analysis time in survival
> analysis where the hazard is associated with age
>

raoul reulen

unread,
Dec 14, 2009, 1:19:48 PM12/14/09
to meds...@googlegroups.com
Bendix, I agree entirely with you and I would prefer using splines or
fractional polynomials. In Stata Roland could use : stpm or mvrs by
Patrick Royston.There is even a good book out on the topic (which I
havent bought yet): http://www.stata.com/bookstore/mmb.html

However, often I find it hard to convince the more senior people in
our department to model the continuous variables. Their argument is
that a table with RRs by the different age groups in 5 year bands is
easier to interpret (and easier to caculate) than a graph showing a
spline. Using the factor approach you could say, the RR was 2.5
between age 60 to 64, but interpreting a graph with a spline is more
difficult.

BXC (Bendix Carstensen)

unread,
Dec 14, 2009, 1:57:46 PM12/14/09
to meds...@googlegroups.com
There is generally a problem with people left over from the hand-calculator-days. But if you insist that the methods section contain statements like:

"We assumed rates were constnt i 5-year intervals with abrupt jumps exactly at ages 40, 45, 50, ... and without any assumptions of the relationsip between groups."

you may make some headway.

The tabular thing largely hinges on the fact that 93.4% of all graphs published in epidemiology journals are unreadable and wrongly laid out. For example with many ultra thin lines equipped with ultra small symbols requiring a legend taking up half the space.

It takes some time to get graphs right, even in R.

Best regards,
Bendix

> -----Original Message-----
> From: meds...@googlegroups.com
> [mailto:meds...@googlegroups.com] On Behalf Of raoul reulen
> Sent: 14. december 2009 19:20
> To: meds...@googlegroups.com
> Subject: Re: {MEDSTATS} Choice of analysis time in survival
> analysis where the hazard is associated with age
>
Reply all
Reply to author
Forward
0 new messages