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
Error in survfit function from "survival" package: "Error in strata(mf[ll]) : all arguments must be the same length"
I have simulated data and I want to get Kaplan Meier estimates.
I have 500 observations,
Y = Observed time, Delta= status
x_bin = Binary treatment variable and x_cont= 2 continuous variables
Y =…

Triparna Poddar
- 408
- 1
- 4
- 14
1
vote
1 answer
How to estimate the median survival with upper and lower confidence limits for the median at 90% confidence levels?
My goal is estimate the median survival with upper and lower confidence limits for the median at 90% confidence levels, using a survfit object.
churn_dat…

Henrich
- 11
- 3
1
vote
0 answers
Survdiff question: comparing Kaplan-Meier and Nelson-Aalen curves
I'm trying to compute a log-rank test that would compare the Kaplan-Meier and the Nelson-Aalen curves. I have the following formulas:
f1_km <- survfit(Surv(futime, fustat) ~ 1, data = data_surv) #Kaplan-Meier
f2_na <- survfit(Surv(futime, fustat) ~…

phdstudent_mtl
- 11
- 1
1
vote
1 answer
Read back the output from fitted survival model
I am using survival data to fit a flexible survival model (example below). I can capture the output of the fitted model as *.txt file and save it in my directory. My question is how can I read back the output into an object in r and use it to plot…

Amer
- 2,131
- 3
- 23
- 38
1
vote
1 answer
Survival analysis: how to transform a population data frame into a data frame with the tidyverse / without a loop in R?
I need to transform a data frame containing population information for each sampling date into a data frame with individual information to run a survival analysis. My data look like…

Mata
- 538
- 3
- 17
1
vote
2 answers
Why does an interval regression using the survival package in R sometimes give questionable standard errors of 0?
I'm running an interval regression model in R using the survival package on interval data. I keep getting estimates where the standard error is 0 and the p-value is infinite in situations where this just does not pass the sniff test. I've also…

natecon
- 21
- 3
1
vote
1 answer
Using 'predict.coxph' from the R package 'survival' in own R package
I want to use the R package survival in my own R package.
My problem is that the function predict.coxph is not exported by survival, which is why I cannot use survival::predict.coxph listing survival under Imports: in the DESCRIPTION file.
Now I…

user3298179
- 163
- 9
1
vote
1 answer
Survival Analysis in Python - Is there any survminer equivalent in Python?
I am a Data Scientist who is an avid R user and currently exploring Python if it helps to broaden my analytics reach. As a first step, I am trying to replicate my current R analyses using Python. Having worked in oncology, I frequently perform…

Navdeep_DS
- 85
- 7
1
vote
0 answers
Different results of coxph with time-varying coefficients between Stata and R
I'm hoping any of you could shed some light on the following. I have been attempting to replicate a Cox PH model from Stata in R. As you can see below, I get the same results for Cox PH models without tvcs in both programs:
Stata Cox PH model
stset…
1
vote
1 answer
Multiple univariate Cox regression with tbl_uvregression() function from {gtsummary}
I can not find how to perform multiple univariate Cox regression with tbl_uvregression() function from {gtsummary}.
Here is were I am so far :
performed multiple univariate logistic regression, with:
tbl_uvregression(dataSOF, method = glm, y =…

B_slash_
- 309
- 2
- 17
1
vote
1 answer
Accelerated Failure Time modelling: plotting survival probabilities with CI-s (example provided)
As proportional hazards assumption is violated with my real data, I am using an AFT model, trying to calculate adjusted survival probabilities for study groups in interest. The example below is on kidney data and I tried to follow ciTools…

st4co4
- 445
- 3
- 10
1
vote
2 answers
How to plot the Hazard Ratio + CI over time of survival data in ggplot in R?
Background
I want to plot the hazard ratio over time, including its confidence intervals, of a survival dataset. As an example, I will take a simplified dataset from the survival package: the colon dataset.
library(survival)
library(tidyverse)
#…

user213544
- 2,046
- 3
- 22
- 52
1
vote
1 answer
Different Kaplan-Meier Results with Interval2
I've noticed a slight difference between survfit when I use a survival object of type "interval2". I first noticed that the number at risk on the interval2 fit was not an integer. I've stepped through survfit.formula and surviftKM but I'm still not…

SmokeyShakers
- 3,372
- 1
- 7
- 18
1
vote
2 answers
ConvergenceError: Convergence halted due to matrix inversion problems
I keep having error messages anytime I try running CoxPH regression in Python. I'm not a pro in python still learning.
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
from lifelines import…

Soloibom
- 11
- 2
- 6
1
vote
0 answers
Time-splitting data for cox regression affects cox.zph() proportional hazards check
I'm doing a cox regression in R using survival::coxph() and the Greg::timesplitter() function to split up my data by time. The impression I got from the documentation is that time-splitting should, in itself, make little to no difference to the…

Ben
- 11
- 2