insightsengineering / insightsengineering/JointSurvivalModels.jl
[Feature Request]: Quantiles and algorithmic search for end of numerical support
- Dominant language
- Julia
- Stars
- 13
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
### Feature description
A good example to ilustrate this is the hazard of the exponential distribution $Exp(\alpha)$ which is just the constant $\alpha$ on the set $[0,\infty)$ and $0$ on the interval $(-\infty,0)$. Here you can see that the support of the hazard starts at $0$ and goes to infinity. To calculate the integral $\int_0^t h(u) du$ we have the implicit assumption that $0$ is the start of the hazard. In case of recorded events before $0$ we would need to adjust the start. This has to be specifed manually! The formulation of the constant hazad needs to contain the information about the start of the support. By default the start of the support is set to a small value above zero, some common hazards are not defined at $0$, i.e. $Weibull (\alpha, \lambda)$ for all $\alpha \in (0,1), \lambda >0$
A **numeric problem** arises when generating a sample. First we solve the integral over the whole support as a callable ode object with DifferentialEquations.jl. This is not possible over a infinite support, thus a **numeric upperlimit** is set; the numeric end of the support. Afterwards the cumulative pdf is calculated and the inverse of a uniform random value in $[0,1]$ is searched by a root finding algorithm. This process assumes we know a numeric end of support, which corresponds to a timepoint at which most evens (for example $0.9999$ of all events) already occured. This could be **searched for algorithmically** given the start of the support (i.e. the default just above 0) and the formulation of the hazard itself.
The nature of this problem is finding quantiles given a hazard function and then finding the $0.9999$ quantile and setting the numeric end this this value (note: error handling of inverse values above $0.9999$)
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct.
### Contribution Guidelines
- [X] I agree to follow this project's Contribution Guidelines.
### Security Policy
- [X] I agree to follow this project's Security Policy.
Contributor guide
Research direction
The issue names no repository files or tests. Start by locating the hazard and sampling code that uses DifferentialEquations.jl and root finding; determine how support bounds and quantiles are represented, then define the expected behavior for the 0.9999 quantile and inverse values above that limit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100