Survival analysis compares the statistical strength of predictors for events encoded as occuring or censored in concert with a time variable. It can be parametric or non-parametric.
Questions tagged [survival]
445 questions
1
vote
1 answer
How to remove extra lines in ggplot2
I'm trying to create a graph of survival over time at a number of different sites.
I have a fairly simple dataframe as below
I have used the following code to make the plot:
my_df <- data.frame(x = Survival$time, y = Survival$`% survival`, group =…

timeywimey
- 41
- 6
1
vote
1 answer
Write wrapper function for `survival::Surv()` with default values
I've been working recently with CDISC data that is structured with pre-specified column names and certain expectations for the way survival data are coded.
I want to write a wrapper for survival::Surv() that uses the structured data of the CDISC…

Daniel D. Sjoberg
- 8,820
- 2
- 12
- 28
1
vote
0 answers
How to incorporate an offset variable while using coxphf()
library(coxphf)
library(survival)
im <- data.frame(X1 <- c(0.482, 0.283, 0.806, 0.510, 0.828, 0.675, 0.430, 0.743,
0.285, 0.954, 0.323, 0.349, 0.338, 0.818, 0.688),
X2 <- c(0.750, 0.690, 0.604, 0.566,…

SaJa
- 11
- 2
1
vote
1 answer
Plot pairwise_survdiff result table together with combined ggsurvplots
I am ploting two survival curves in combination using ggsurvplot_combine: one for the overall survival and another one for survival by a specific variable. I would like to also show the p-values for the survival comparison of each combination in the…

Eduardo Magalhaes
- 11
- 3
1
vote
0 answers
How to predict risk scores with Cox models using lifelines package?
I have made multiple cox models with Lifelines package and I am trying to predict the risk score of each individual following information in CoxPhFitter page. predict_hazard is a suggested command in that page, but when I use it to predict risk…

Ali Fahmi
- 21
- 1
1
vote
0 answers
Survival plot appearance
I am trying to recreate the following plot -
I found this plot in other papers so I thought maybe there is some package I have skipped.
I got a really close result using ggsurvplot function with this tutorial -
but I failed to:
Add the gap in the…

Daniel Ostrovsky
- 11
- 1
1
vote
0 answers
Pooling Survreg Results Across Multiply Imputed Datasets - Error Message: log(1 - 2 * pnorm(width/2)) : NaNs produced
I am trying to run an interval regression using the survival r package (as described here https://stats.oarc.ucla.edu/r/dae/interval-regression/), but I am running into difficulties when trying to pool results across multiply imputed datasets.…

Rachel
- 33
- 5
1
vote
0 answers
Confidence intervals on parameter estimates for an ATF model in R
UPDATED with dataset and code: dataset code
I have a Cox regression and an ATF regression with the same covariates and dependent variables in R; that is, the only difference between the two is the modeling function. I'm trying to get the confidence…

MWolcott
- 23
- 4
1
vote
1 answer
95% CI for survival linear combination (interaction) using vcov
i have this model
Where TD is a binary variable, and Strata is a numeric variable equals to {1,2,3}. I need to get 95% CI for this two linear combinations:
I have this function to construct confidence intervals
pwp_gt_int <-…
1
vote
2 answers
Convert "survfit()" output to a matrix or dataframe
Example data below.
My basic problem is that running "survfit" by itself gives a nice column with median lifespan for each category, which is the thing I want to extract from my survfit data. Ideally I'd like to export this "survfit" output as a…

Crawdaunt
- 89
- 1
- 12
1
vote
0 answers
How to obtain expected time to death from ranger survival predictions?
I am trying to obtain the expected time to death from ranger predictions. Given the code below, how do I estimate the time to death from the survival probability in predictions$survival?
library(survival)
library(ranger)
data <- pbc
data <-…

Luca_brasi
- 89
- 7
1
vote
0 answers
What is the output of predict.coxph() using type = "survival"?
I am trying to learn what the various outputs of predict.coxph() mean. I am currently attempting to fit a cox model on a training set then use the resulting coefficients from the training set to make predictions in a test set (new set of data).
I…

Mao Pineda
- 11
- 1
1
vote
2 answers
Using tidy selection together with the survival package - "Error: promise already under evaluation"
I am writing an R function that allows the user to specify an individual time variable when creating a survival::survfit object. The survival package has a "string-free" syntax, which means that the name of the time variable (in my case "dtime")…

Lukas D. Sauer
- 355
- 2
- 11
1
vote
1 answer
Creating survival curve from summary plot
The software that I am using gives the summary output of the survfit function. What is the easiest way to take this information and use the ggsurvplot function? I understand that this summary data is in a different format from the traditional data…

davidk
- 133
- 2
- 11
1
vote
1 answer
R Survminer Pairwise Survival difference Variable length error
Hello I am using the survival package and the survminer package to do some analysis. I am having trouble with pairwise_survdiff from the survminer package.
Here is some simulated data that mimics my…

Victor Feagins
- 126
- 10