5
$\begingroup$

I'm sorry if this question is too broad for this board. I'm trying to figure out a survival model for my data. Right now I have it organized by country, year, "cur" which is my main IV, and event. I have an example of my data below. My issue is my main IV changes over time and I can have multiple events per country. It seems like having both of these should be possible in a survival model, but I don't know what model specifically I'd need or what R package to look towards. I'd really appreciate any advice. Again I apologize if this question isn't specific enough for this board.

id country year cur event 191 Suriname 1975 0.1269722 0 192 Suriname 1976 0.3103358 0 193 Suriname 1977 0.3103358 0 194 Suriname 1978 0.3103358 0 195 Suriname 1979 0.3103358 0 196 Suriname 1980 0.3571018 1 197 Suriname 1981 0.1718919 0 198 Suriname 1982 0.1718919 0 199 Suriname 1983 0.1718919 0 200 Suriname 1984 0.1718919 0 201 Suriname 1985 0.3442552 0 202 Suriname 1986 0.3442552 0 203 Suriname 1987 0.3665857 0 204 Suriname 1988 0.3560681 0 205 Suriname 1989 0.3671406 0 206 Suriname 1990 0.3671406 1 207 Suriname 1991 0.3671406 0 208 Suriname 1992 0.3671406 0 ...

Edit:

Thanks to everyone for the information and the informative discussion. My events here, regime failure, can theoretically happen more than once in a year but in the time frame I'm looking at it's very rare, to the point of almost not happening. I'm also sensitive to the point that I have only year level data for my IV and the events can happen at different points within a year. However the data is just not detailed enough to go to a time period less then a year. I think I can live with year long intervals without really missing a lot of nuance. I have about 100 years of data with 10,000ish country-year observations and 360ish events so I don't think I loosing too much with year level data. I'm also not that worried about the direction of causation here and the IV is a measure that should be relatively stable throughout the year.

Edit #2

I have another more technical R question if anyone is still reading this. I added another column so that each year now has an end year. The data now looks like:

id country year year_end cur event 191 Suriname 1975 1976 0.1269722 0 ...

I then ran this CoxPH model:

coxph(Surv(year, year_end, event) ~ v2x_corr, data = z)

However I'm concerned that I might have just treated each country-year as a totally separate case.

$\endgroup$
  • 1
    $\begingroup$ Surely the survival outcome is not the death of the country. Is the event indicator an "incidence" of something in each country, like a case of HIV? What values does "event" take? This looks more like a lifetable analysis and not a survival analyses per se. $\endgroup$ – AdamO Mar 7 '17 at 22:18
  • $\begingroup$ The event would be a revolution or some type of regime failure. $\endgroup$ – Daniel Mar 7 '17 at 22:49
  • 1
    $\begingroup$ Yeah so you could easily have 10 or 20 revolutions in a year, unlikely, but it's not a survival model in the sense you can compare countries to each other so easily. Estimate incident rate ratios using a loglinear model for lifetables. This is just a Poisson model where you control for year and country as a covariate in the model. $\endgroup$ – AdamO Mar 7 '17 at 22:52
  • $\begingroup$ We need more information on what these data are. But so far I agree with @AdamO. It seems that you are counting events of some kind by country and year. The sample data are just 0s and 1s but there is a hint that multiple events are possible $\endgroup$ – Nick Cox Mar 8 '17 at 11:57
4
$\begingroup$

This is a situation with recurrent events (i.e., possibly more than one) and time-dependent covariates, which with some care can be handled pretty easily. For example, this can be done in R with the coxph() function in the survival package--if your data are formatted correctly. You need to specify your data with separate lines for time intervals of interest for each subject, over which covariate values are constant and which may be terminated by an event. There are tools in the package (e.g., the tmerge() function) to make this formatting easier. This vignette provides some examples. There will probably be a learning curve involved the first few times you try.

Think carefully whether survival analysis is actually going to be appropriate for your problem. See this page for some discussion. Also consider carefully the point raised by @AdamO with respect to lifetable versus survival analysis. If you do use Cox survival analysis with a time-dependent covariate, it is the values just before each event time that enter the regression. If the covariate values are end-of-year but the event happened during the year, then that's not appropriate as the potential causal direction is incorrect. That problem can be handled by re-formatting the data. With data only coming once per year some would suggest a discrete-time survival analysis instead of the continuous-time model implicit in coxph(), but I have no experience with that.

I'm not as great a fan of parametric models as is @MichaelChernick, but if you have a particular theoretical model in mind that could also be a reasonable approach.

$\endgroup$
  • $\begingroup$ The discrete nature of time in these data indicates interval-censored survival times, which the cox proportional hazards model cannot handle---but a parametric model can. $\endgroup$ – gammer Mar 8 '17 at 5:11
  • $\begingroup$ Thanks. I added another column so that each year now has an end year. So instead of saying Suriname 1975 it now has Suriname 1975 1976 for that line. I then ran this CoxPH model: coxph(Surv(year, year_end, event) ~ v2x_corr, data = z) However I'm concerned that I might have just treated each country-year as a totally separate case. $\endgroup$ – Daniel Mar 8 '17 at 21:06
-1
$\begingroup$

Try a parametric method first. If the fit is adequate use it. Otherwise the Kaplan-Meier survival curve can be used.

$\endgroup$
  • 3
    $\begingroup$ Since the comments reveal that neither the data nor the question concerns survival, recommending a survival analysis seems misleading at best. $\endgroup$ – whuber Mar 8 '17 at 0:51
  • 1
    $\begingroup$ Listen a survival analysis is exactly what the OP asked for and it seems appropriate to me to do it the way I suggested. $\endgroup$ – Michael Chernick Mar 8 '17 at 0:53
  • 5
    $\begingroup$ Suppose you were a physician and a patient came through your door with an earache, asking for a prescription for LSD. Would you actually prescribe that for her? Of course not. Responsible statistical practice begins with working to understand the problem rather than accepting the OP's characterization of it. $\endgroup$ – whuber Mar 8 '17 at 0:56
  • 2
    $\begingroup$ To me, the comments indicate that the inferential target is the expected time until an event, with possibly multiple events, so a survival analysis that allows multiple events seems on point. A parametric model is particularly suited to that purpose, particularly given the interval censored nature of the data (i.e. you only know if an event happen during a given year, not the exact timing). +1 $\endgroup$ – gammer Mar 8 '17 at 5:31

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.