Questions tagged [survival]

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.

445 questions
1
vote
0 answers

R function for Parametric Survival Analysis that allows for modification of parameters

I am trying to perform a set of survival analyses on surgical duration, with a set of covariates as controls. The purpose is to compare the coefficients and marginal effects of covariates across different distributional forms (e.g., exponential,…
J.K.
  • 325
  • 2
  • 8
1
vote
1 answer

How to set custom x axis interval in survival plot?

How to change the x axis intervals to 1,10,20...100 instead of 0,25,50,100 ? I used folloing code to generate the survival plot library(survminer) library(tibble) library(survival) library(data.table) #Create dataframe datam = data.table(ID=1:100, …
user2110417
1
vote
0 answers

Plotting survival curves with time dependent covariates in R

I've been trying for multiple days to visualize my Cox regression with time-dependent covariates with no luck. I'd like to isolate one of two time-dependent covariates to visualize its effect on survival probability, risk, hazard ratio, and/or…
NorthLattitude
  • 201
  • 1
  • 12
1
vote
1 answer

Generating a risk table from survival package

Is there an inbuilt function that generates a risk table in the survival package? I want to report the number at Risk, number of events, and number of censors by time interval. If this is not available, is there a way to produce this table…
user1916067
  • 127
  • 1
  • 11
1
vote
1 answer

How to calculate confidence intervals for crude survival rates?

Let's assume that we have a survfit object as follows. fit = survfit(Surv(data$time_12m, data$status_12m) ~ data$group) fit Call: survfit(formula = Surv(data$time_12m, data$status_12m) ~ data$group) n events median 0.95LCL…
st4co4
  • 445
  • 3
  • 10
1
vote
1 answer

Two different results from coxph in R, using same stop and start times, why?

I am running into a roadblock in my survival analysis; I think it has to do with censoring type. Here is the first 30 lines of my survival data. tstart is when a patient is admitted and starts receiving the Intervention, tstop is either death…
aparish
  • 71
  • 4
1
vote
0 answers

SAS twosamplesurvival sample size question

I am trying to perform a sample size calculation in SAS for a two sample time to event case. Here is the situation: Assume both sample follows exponential distribution Assume a given constant hazard ratio under alternative hypothesis, we call hr…
battousai1983
  • 101
  • 1
  • 3
1
vote
0 answers

ROC curve in R with rpart for a survival tree

I have an issue with creating a ROC Curve for my survival tree created by the rpart package. My goal was to evaluate my survival tree through Area Under Curve (AUC) in ROC curve. I had tried many ways to plot a ROC curve but failed. How can I…
Gin
  • 11
  • 2
1
vote
0 answers

Fitting a survival curve with survfit()

I have a survival data, df, as shown below: df <- structure(list(time_to_event = c(369L, 4597L, 2154L, 4426L, 823L, 4248L, 1045L, 4186L, 1305L, 1960L, 3905L, 5L, 3840L, 3802L, 3730L, 280L, 3678L, 81L, 59L, 3360L, 3318L, 3142L, 2912L, 2909L, 2873L,…
HNSKD
  • 1,614
  • 2
  • 14
  • 25
1
vote
1 answer

rbind dataframes with survival::Surv objects

How do I combine two dataframes that include survival::Surv objects such that the fields in the resulting dataframe have the same class as the source data frames? I have found that using rbind results in the Surv objects being converted to matrices.…
greengrass62
  • 968
  • 7
  • 19
1
vote
0 answers

Time-varying covariates in Weibull AFT Bayesian Survival model in R using rjags package

It has been a while that I am trying to find a way in rjags to write a code for a Bayesian Weibull AFT Survival Analysis model with time-varying (time-dependent) covariates. The data I am working on is about the duration from buying to disposal.…
Mary B
  • 13
  • 3
1
vote
1 answer

How to run a bunch of models in R using a Function

library(survival) justices <- read.csv("http://data.princeton.edu/pop509/justices2.csv") PREDS = c("age", "year") m = coxph(Surv(tenure, event == 1) ~ age + year, data =…
bvowe
  • 3,004
  • 3
  • 16
  • 33
1
vote
2 answers

Implausibly wide confidence intervals produced by survfit() for interval censored data

I have data which is generated by intermittent interviews in which an individual is asked whether they are experiencing a certain symptom. The last time each individual was known to not have this particular symptom, is denoted as tstart. If…
user6571411
  • 2,749
  • 4
  • 16
  • 29
1
vote
0 answers

flexsurv package: code for plotting predictions on Kaplan-Meier curves for two study groups

Code I used for data entry: library(tidyverse) library(survminer) library(flexsurv) library(survival) library(finalfit) data = read_delim("data.csv", ",", escape_double = FALSE, trim_ws = TRUE) data = data %>% mutate_if(is.character,…
st4co4
  • 445
  • 3
  • 10
1
vote
1 answer

R Extract Data From SurvFit

library(survival) etime <- with(mgus2, ifelse(pstat==0, futime, ptime)) event <- with(mgus2, ifelse(pstat==0, 2*death, 1)) event <- factor(event, 0:2, labels=c("censor", "pcm", "death")) mfit2 <- survfit(Surv(etime, event) ~ sex,…
bvowe
  • 3,004
  • 3
  • 16
  • 33