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
2
votes
0 answers

Is there a way to assess proportional hazards with the tt() function in the survival package currently?

I know that in the survival package, you are able to define a function which allows you to transform time in the event that you have a covariate that violates proportional hazards. However, in the documentation I've seen, you should be able to run a…
Ryan
  • 77
  • 7
2
votes
1 answer

Produce empty Plot with ggsurvplot

Is it possible to produce an empty plot with survminer::ggsurvplot? Here is an example. Say, dependent on the number of groups, I want to create a ggsurvplot. Figure 1 shows an example with 2 groups. If there are no groups, the desired outcome…
otwtm
  • 1,779
  • 1
  • 16
  • 27
2
votes
0 answers

How do you predict survival times with randomForestSRC?

Here is a toy competing-risks survival problem: library(randomForestSRC) library(data.table) set.seed(10) N = 500 d = data.table( x1 = runif(N, 100, 150), x2 = runif(N, 100, 150)) d[, e1.time := x1 + runif(N, -2, 2)] d[, e2.time := x2 +…
Kodiologist
  • 2,984
  • 18
  • 33
2
votes
1 answer

Plot: how to change the breaks?

I'm plotting a survival curve with the survival library, and I haven't found any way to change the breaks range. For example: library(survival) temps <- c(5,15,25,30,18,16,38,40,40,40,40,40,40,40,40,40) deces <-…
Kolia51
  • 23
  • 5
2
votes
1 answer

Change legend labels in ggcompetingrisks plot in r

I have made a cumulative incidence plot using cmprsk::cuminc and then ggcompetingrisks for plotting. I want to change legend labels for the group. I've tried with legend.lab = c("A", "B", "C"). This works when I do a ggsurvplot without competing…
2
votes
1 answer

Object '.' not found while piping with dplyr

I am trying to conduct a survival curve using the survival package. The MWE code is as follows: df %>% filter(fac <= "Limit") %>% survfit(Surv(tte, !is.na(event)) ~ fac, data = .) %>% ggsurvplot(fit = .) I get the error Error in…
Dylan Russell
  • 936
  • 1
  • 10
  • 29
2
votes
1 answer

R - cox.zph() not returning rho values, p-values differ from examples

When I run cox.zph on a Cox model, I get a different type of return than I am seeing everywhere else. I tried running the following code: library(survival) #version 3.1-7 library(survminer) #version 0.4.6 res.cox <- coxph(Surv(time, status) ~ age +…
shwalters
  • 23
  • 4
2
votes
1 answer

Does anyone know what the difference between n and strata in a survobject?

Whenever I use survfit in R I get different values for n and strata: For example I get n: 150, 167 (add up to 317 which is the total input) strata: 149, 163 From the help page ?survival::survfit.object: n = total number of subjects in each…
Agustin
  • 1,458
  • 1
  • 13
  • 30
2
votes
0 answers

`mstate`: prepare "long" format data into "mstate" format data

The typical preparation steps for mstate involve converting "wide" format data (1x row per 'patient') into "multi-state" format data (multiple rows per 'patient' for each possible transition in the multi-state model). For example, data in wide…
NickBraunagel
  • 1,559
  • 1
  • 16
  • 30
2
votes
2 answers

In R: survminer::ggsurvplot with fun = "cloglog" returns warning message and empty plot

Please consider the following: With the survminer package we can draw 'log-log' plot for survival objects created with the package survival. This has been introduced a while ago by the package developer @kassambara here. Until recently everything…
Frederick
  • 810
  • 8
  • 28
2
votes
1 answer

How to include a Surv object as a new column in a data.table?

I'm performing survival analysis, and I want to create a Surv object as its own column in a data.table. Although Surv objects are considered vectors, I can't use them to make new column since they are actually a 2 column matrix. Is there an elegant…
Dewey Brooke
  • 407
  • 4
  • 10
2
votes
1 answer

Customising line type in adjusted survival curves ggadjustedcurves (survminer, ggplot2)

I'm trying to plot an adjusted survival curve, but struggling with changing the line types by group. I'm able to customise other aspects of the plot using typical ggplot2 language, but I've hit a wall with changing line type.…
T.P.
  • 87
  • 1
  • 6
2
votes
2 answers

Expand each row with specific value in tidyr

I have a dataset with grouped observations per row. However, I would like to expand each row observation from a single observation per replicate to a set number (in this case "20" observations each). In the attached picture, Each replicate is a…
2
votes
0 answers

In Surv(start_time, end_time, new_death) : Stop time must be > start time, NA created

I am using the package "survival" to fit a cox model with time intervals (intervals are 30 days long). I am reading the data in from an xlsx worksheet. I keep getting the error that says my stop time must be greater than my start time. The start…
2
votes
0 answers

Survival AFT Analysis with Scala

I am trying to implement the survival analysis model as documented here: Scala-Docs#Survival-Regression but I cannot make heads or tails of how you are supposed to do the actual implementation. I am trying to model the "survivability" of a customer…
EliSquared
  • 1,409
  • 5
  • 20
  • 44