Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

# Interval events

See original GitHub issue

Thanks for the awesome work.

I am trying to do some survival analysis where the observations are done on fixed intervals. Is there anyway to handle these types of information?

The following is an example of such data

``````    Start   Stop  Censored
0    4640    NaN      True
1    4640    NaN      True
2    4640    NaN      True
3    4640    NaN      True
4    4640    NaN      True
..    ...    ...       ...
15    215  464.0     False
16      0    1.0     False
17   4640    NaN      True
18   4640    NaN      True
19   4640    NaN      True
``````

Here, if the `Stop` column is `NaN` then the data is censored, but if the `Stop` has a number then the event happened between `Start` time and `Stop` time.

Thanks for the help

### Issue Analytics

• State:
• Created 4 years ago

1reaction
CamDavidsonPiloncommented, Apr 12, 2019

So version 0.21.0 (just released) has initial support for parametric models of interval censoring. Here’s an example: https://dataorigami.net/blogs/napkin-folding/counting-and-interval-censoring

Next is to do non and semi parametric models, but that’s for the medium-term future.

Your example can be modelled something like:

``````from lifelines import LogLogisticFitter

df['stop'] = df['stop'].fillna(np.inf)

llf = LogLogisticFitter().fit(df['start'], df['stop'])
llf.plot_survival_function()
``````

I believe that’s it! I’m treating your right censored as interval censored (with an endpoint at infinity).

1reaction
CamDavidsonPiloncommented, Apr 4, 2019

It’s not hard to write down the likelihood for this data (assuming a parametric model). It would be a combination of eq (2) and (3) in this paper: https://cran.r-project.org/web/packages/flexsurv/vignettes/flexsurv.pdf

#### Top Results From Across the Web

The Interval at Long Now
The Conversations at The Interval are intimate salon style events centered around long-term thinking featuring renowned authors, scientists and artists.
Actions and Events in Interval Temporal Logic
Events are defined to occur over intervals of time, and cannot be reduced to some set of properties holding at instantaneous points in...
Intervals
We can define the interval between events A and B very simply: Square the distance between the events, then subtract from that the...
Event interval analysis: Why do processes take time?
Event intervals can be calculated from event logs. In essence, an event interval is a period of time between the occurrences of two...
Queue service interval events examples - IBM
Queue service interval events examples · Figure 1 is a graph of queue depth against time, showing individual MQGET calls and MQPUT calls....

#### Troubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free