insightsengineering / insightsengineering/ggplot2.utils
Add support for other survival estimates
- Lenguaje dominante
- R
- Estrellas
- 9
- Forks
- 1
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Currently using this package it is only possible to add reference lines for survival estimates via KM estimates. However it is common for users to plot their survival data in terms of transformations of the survival function e.g.
- Hazard function
- Cumulative Hazard function
- Log Hazard function
It would be good for this package to support these as well.
Cumulative Hazard estimates are already available from the `survfit` function
```
x <- survfit(Surv(time, event) ~ 1, data = dat)
x$cumhaz
```
Hazard functions are more complex. I'm not sure what the best way is but I see many recommendations for [`muhaz`](https://rdrr.io/cran/muhaz/man/muhaz.html) e.g.
```
muhaz::muhaz(dat$time, dat$event)
```
Though it doesn't appear to have a grouping option so you would need to loop over the required groups.
Guía de contribución
Línea de trabajo
Start by reviewing the package's existing KM-estimate reference-line support and the survfit entry point, including its cumhaz output. Compare the desired cumulative, hazard, and log-hazard estimates, then investigate muhaz for grouped hazard calculations and define the supported behavior before implementation.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- r
- Área
- data-visualization
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100