1
$\begingroup$

I am not sure if this belongs is stack overflow or in cross-validated, so, I apologize if some feel it is in the wrong place. I am trying to do a survival analysis for 55 nests over a three year sampling period. Sample data, where;

  1. Discovery is day of nesting period nest was discovered with 1 = to the day the first nest was discovered

  2. Lastalive = last day nest was seen alive

  3. Lastchecked = last day nest was checked

  4. Nestfate = 0 succesful and 1 failed(predated, abandoned, or hen predated away from nests)

If nest was successful Lastalive and Last checked are the same day/number.

Discovery   lastalive   Lastchecked Nestfate
 1  1   3   1
 1  27  27  0
1   27  27  0
4   25  25  0
4   11  20  1
4   25  25  0
11  22  22  0
4   26  26  0
12  26  26  0
11  34  34  0
8   8   14  1
26  35  35  0
11  15  15  1
9   32  32  0
8   26  26  0
12  26  26  0
8   26  26  0
11  26  26  1
8   29  29  0
4   26  26  0
8   35  35  0
1   35  35  0
15  15  17  1
8   8   10  1
15  34  34  0
5   15  20  1
9   33  33  0
4   26  26  0
14  36  36  0
16  25  25  0
14  35  35  0
20  26  26  1
8   27  27  0
15  22  28  0
16  34  34  0
17  24  34  1
17  34  34  0
8   35  35  0
11  26  26  0
16  30  30  0
6   32  32  0
5   24  34  1
1   31  31  0
5   30  30  0
8   31  31  0
1   1   5   1
9   34  42  0
17  24  34  1
16  31  31  0
16  33  33  0
15  28  28  0
24  38  38  0
16  32  32  0
12  28  28  0
8   37  37  0

 S <- Surv(time = nestdata$Discovery, time2 = nestdata$lastalive, event = nestdata$Nestfate) 

s = npsurv(Surv(nestdata$Survtime,
nestdata$Nestfate)~ 1, data=nestdata, conf.type="log-log") 

survplot(s, xlab="Time") 

summary(s)

SurvXTime

 time n.risk n.event survival std.err lower 95% CI upper 95% CI
1.0     55       3    0.945  0.0306        0.840        0.982
2.0     52       1    0.927  0.0350        0.818        0.972
3.0     51       1    0.909  0.0388        0.795        0.961
 4.0     50       1    0.891  0.0420        0.773        0.949
6.0     49       1    0.873  0.0449        0.751        0.937
11.5     44       1    0.853  0.0481        0.727        0.924
12.0     43       2    0.813  0.0534        0.680        0.895
12.5     41       1    0.793  0.0557        0.658        0.880
15.0     35       1    0.771  0.0585        0.631        0.863
24.0     12       1    0.706  0.0816        0.513        0.834

So, I am wondering if I am am doing this corectly. Should my 'event' be a midpoint between lastalive and last checked? The nesting period, from time of discovery of 1st nest to the time of last nest hatched or predated is 42 days. How would I calculate mean survival time of nests with standard error over this period? and how would I summarize the summary output for my report into something meaningful. Now if I understand, I can then use this as baseline data for further analysis with covariates. With my factor covariates I would use the kaplan-meier, however, if I have numeric data I would use Coxph? And, if I wanted to have seperate survival curves for each study year or area on the same plot, would this be possible? if so, how would one go about this?

MODEL <- survfit(Surv(
time = nestdata$Neststart, 
time2 = nestdata$lastalive, 
event = nestdata$Nestfate) ~ Age, data = nestdata)

model <- coxph(S ~ VOR2, data = nestdata)
$\endgroup$
2
  • 1
    $\begingroup$ The last paragraph of your question suggests that you should read some more about survival analysis before delving into the calculation, as it basically boils down to: how to do survival analysis. However, as to: Should my 'event' be a midpoint between lastalive and last checked? You know the event happened some time in between two times you checked, so that would make it interval censored. $\endgroup$ – Frans Rodenburg Jan 26 '18 at 8:40
  • $\begingroup$ There's also the complication that the analysis starting time for each nest seems to be when it was discovered, not when it was constructed or when (say) eggs were laid in it, which would probably be what you are most interested in. If so, you have left censoring too, not just right censoring and interval censoring, which is a pretty advanced topic in survival analysis. $\endgroup$ – EdM Jan 26 '18 at 12:06
2
$\begingroup$

Strictly speaking, your data are interval censored: the event is known to be after lastalive and before lastchecked. In practice, you can often ignore the problem of interval censoring and treat Lastchecked as the follow-up time. Here's a comparison between right-censored (red) and interval-censored (black), with time starting at 0 and ignoring Discovery. Both types of survival curve can be done with survival::survfit, though interval censoring for the Cox model is a bit more tricky. They are similar

The other choice, which is perhaps more important, is when to start the survival time. Do you want to start at zero, with Discovery just as the time the nest is observed, or do you want to start at Discovery. If it's the former, you need to treat Discovery as a left-truncation time. Since I don't know of software that can handle left-truncation and interval-censoring in the same dataset, the approximation of treatment Lastchecked as the event time becomes more useful.

In the plot below, the black curve ignores left truncation (don't do this). The purple curve has left truncation at Discovery and the orange curve has time zero starting at Discovery (with the +1 because of how ties are handled)

s = survfit(Surv( Lastchecked,Nestfate)~ 1, data=nestdata, conf.type="log-log")
t = survfit(Surv( Discovery,Lastchecked,Nestfate)~ 1, data=nestdata, conf.type="log-log")
u = survfit(Surv( Lastchecked-Discovery+1,Nestfate)~ 1, data=nestdata, conf.type="log-log")
plot(s,conf.int=FALSE)
lines(t,conf.int=FALSE,col="purple")
lines(u,conf.int=FALSE,col="orange")

big difference: black higher than orange higher than purple

As you can see, this makes more difference than the question of interval censoring vs right censoring. I think you want the orange curve, but you need to decide.

You can then use Cox models to look at associations with covariates.

$\endgroup$
-1
$\begingroup$

For obtaining separated survival curves you have to stritified, after that with survival curves' trends you can check the proportional hazards assumption before using Cox's regression model. But you didn't understand well how survival analysis work, i'm in according with Frans Rodenburg you should read more about these topics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.