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

MLE simulation data for survival analysis covariate in R

I was trying to do simulation on mle for my model which is a parallel exponential model to estimate the covariate which is b0 and b1. t and x I got generate using random numbers. My pdf is f(t) = 2 * (lambda * exp(-lambda * t)) * (1- exp(-lambda *…
zira
  • 15
  • 3
0
votes
1 answer

Updating a msfit object class using a new list of objects in R

I am using the msfit function in mstate package to predict/fit the cumulative transition hazards for a new data. Then I want to manually update the cumulative transition hazards stored in the msfit object with some new info, but I got stuck here. I…
ssaha
  • 459
  • 2
  • 10
0
votes
2 answers

Is there a way to get max consecutive counts of 1s across columns in SQL?

Is there a way to get maximum consecutive counts across columns in SQL? I'm looking for longest duration of survival. For example, if I have a dataset that looks like this ID T1 T2 T3 T4 T5 T6 T7 T8 T9 1 1 1 0 0 0 1 1 1 …
0
votes
1 answer

Get confidence intervals and exp with broom from nested coxph-models

Data and libraries: test <- tibble(start=c(1,2,5,2,1,7,3,4,8,8), age=c(2,3,6,7,8,9,9,9,14,17), event=c(1,1,0,1,1,1,1,0,0,0), x=c(1,0,0,1,0,1,1,1,0,0), …
Droc
  • 257
  • 1
  • 2
  • 8
0
votes
2 answers

Why is survival::tmerge suddenly giving error "neither a tstop argument nor an initial event argument was found"?

I'm trying to run the following code, including survival::tmerge() to conduct survival analysis with time-varying covariates, but i always get the error Error in tmerge(df.merge %>% select(CODE98, id), df.long, id = CODE98, : neither a tstop…
Devanto
  • 33
  • 5
0
votes
0 answers

C-index for each treatment arm with variable-treatment interaction

I have difficulty calculating the C-index (UnoC with survAUC R package) for each treatment arm to assess the variable-treatment interaction. I have a database with 4 explanatory variables X1, X2, X3, X4, as follows: > str(data) 'data.frame': 1000…
Ph.D.Student
  • 704
  • 6
  • 27
0
votes
0 answers

How to add a strata variable in the crr function?

I am trying to test out a Fine and Gray regression and to validate if both the "crr" package and the "survival" package produce the same results. I will then be putting these results into Latex. The survival results work, but for the crr results I…
0
votes
0 answers

How to do survival analysis in R with time-varying exposure to an intervention, using Surv and coxph?

I have survival data in this format, with a time-varying exposure to Intervention: ID start stop status Intervention 1 2 14 0 0 2 2 5 0 0 3 2 3 0 0 3 3 10 1 1 4 5 8 0 …
aparish
  • 71
  • 4
0
votes
1 answer

median VS survival median (from survfit)

This may seem like a silly question, but I was wondering why the median from median and the median from survfit ("survival package") are different I tried to simulate the tutorial in sciencing.com: List the survival time of all the subjects in your…
0
votes
1 answer

Running multiple Cox-PH models with tidyr

I have a regular Surv object from the survival package; s <- Surv(sample(100:150, 5), sample(c(T, F), 5, replace = T)) And a matrix of multiple variables; df <- data.frame(var1 = rnorm(5), var2 = rnorm(5), var3 =…
Ronny Efronny
  • 1,148
  • 9
  • 28
0
votes
1 answer

michiganCoxSurv and undefined columns selected

I have an input file that attempts to match the example given by the package (trimmed for MWE) Data structure(list(ID_1 = 1:4, ID_2 = c("MZGVVGDE", "MZDBADNE", "ZBAZDCC", "ZBCBEAAZ"), event = c(0L, 0L, 0L, 0L), age = c(44L, 62L, 67L, 58L),…
con
  • 5,767
  • 8
  • 33
  • 62
0
votes
1 answer

Predict customer lifetime values with Cox PH survival analysis

I want to predict the customer lifetime value for each client while many clients are still active, hence right censored data. I'm using the survival library for my censored data. I then run the coxph model to fit the training data and obtain the…
Michieldo
  • 169
  • 1
  • 2
  • 15
0
votes
1 answer

'termlabels' error in coxph() function of survival package

I am trying to analyse a reoccurring event dataset and I am struggling to fit the model. A subset of my data: outdat <- structure(list(yr = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
m_c
  • 496
  • 2
  • 19
0
votes
1 answer

Survival function with dropdown menu for each gene

I am trying to make a shiny app where you can select different miRNA in my input then plot the survival curve using ggsurvplot. There is something wrong with the functions within fitSurv, but I am not sure where I am doing it wrong. library(dplyr)…
user2300940
  • 2,355
  • 1
  • 22
  • 35
0
votes
1 answer

Package installing question, (Survival analysis)

I met this problem when I install the package “survminer” Other packages are still available for installing except for this one. How could I solve this problem? Should I update my Rstudio ?