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
0
votes
1 answer
Reshaping longitudinal dataset with tmerge or SurvSplit?
I'm attempting to conduct survival analysis with time-varying covariates. The data comes from a longitudinal survey that is administered annually, and I have manipulated it to look like this:
id event end.time income1 income2 …

Ryan
- 77
- 7
0
votes
1 answer
gestate doesn't recognize numeric variable
I have a survival dataset and want to use package gestate for analysis.
When I intent to fit model I obtain:
fit2 <- fit_tte_data(data=survdata,Time="dias",Event="entrega",censoringOne=F,type="automatic")
Error in Surv(T, E) : Time variable is not…

panchtox
- 634
- 7
- 16
0
votes
1 answer
use labels in cox regression results
Trying to add labels to variable name to make it more coherent when displaying results
The following
library(survival)
data(lung)
Hmisc::label(lung$sex) <- "Gender"
res.cox <- coxph(Surv(time, status) ~
as.factor(sex)
, data =…

Edi Itelman
- 423
- 5
- 14
0
votes
1 answer
Getting the error (subscript) logical subscript too long
I'm trying to run the following code, but I got this error
Error in unclass(x)[i, , drop = FALSE] :
(subscript) logical subscript too long
library ( survival )
library(KMsurv)
data("tongue")
tongue
Weibull.1<-survreg(Surv(times,censor)~1,…

Dana
- 75
- 5
0
votes
0 answers
simsurv R function: is there a way to define different censor rates?
I'm trying to generate a few simulated survival datasets. I've chosen the simsurv function as it allows me to generate time varying coefficients (and hence non-proportional hazards). However, how do I go about defining different censor rates (10%,…

Kay
- 1
0
votes
0 answers
Error using rmst2 function (restricted mean survival time) from survRM2 package
I am looking to compare two survival curves using the restricted mean survival time in R. As such, I am using the survRM2 package and following this R vignette.
I am able to obtain the unadjusted analysis, as in section 3.1, by…

Mateus
- 47
- 2
- 8
0
votes
1 answer
Get a 'survfit' object which will be the same size than the original data in case of ties? (survival, R)
I want the survival probability estimated by Kaplan-Meier estimator for each individual of my dataframe.
The survfit(Surv(.)) function calculates the survival probability for each unique time ordered by decreasing order.
What would be an elegant…

Flora Grappelli
- 659
- 9
- 26
0
votes
0 answers
Competing risk survival curves: R vs Stata
I have done a competing risk survival analysis both with R and Stata. I have two cohorts of patients. However when plotting the curves I obtained very different results.
For R I used the command cuminc(ftime,fstatus,group,cencode=0) and then…

Nico
- 1
0
votes
0 answers
Time-varying covariates: formatting for one categorical variable with 3 levels
(This is an edited version of a previously closed question)
I have a data.frame (condensed to testdata) of several demographic variables in addition to one variable with three levels for three possible comorbidities.…

Mircea_cel_Batran
- 95
- 2
- 10
0
votes
1 answer
Issue with R Shiny App --> Interactive Survival Plots
I am new to R Shiny and I am trying to build a Shiny Web App that produces a survival plot with two reactive inputs. The first input is the study (total=4). The second input is the groups (total=19) to compare survival curves. Ideally, these two…

user2813606
- 797
- 2
- 13
- 37
0
votes
0 answers
Is Accelerated Failure Time (AFT) method acceptable for answering my study question (an example)?
I need to conduct an adjusted survival analysis, however, Cox PH assumption was not met and data stratification isn't a good solution as one of my study groups already has a small number of patients. Thus, I tried to fit my first AFT model, however,…

st4co4
- 445
- 3
- 10
0
votes
0 answers
Cox Hazard Model: why multiple factor levels are reference?
When conducting a multivariate Coxph model with categorical predictors, and after releveling all predictor variables (function= relevel()), two of my predictor variables have multiple levels that are "references", eliminating several analyses.…

SpencerS
- 1
- 1
0
votes
1 answer
conducting a Tukey test on R
I'm trying to a Tukey test on the data (bmt), (KMsurv) and focusing on the variables t2 and d3 only.
t2: the disease free survival time (time to relapse, death or end of study)
d3: indicator variable for disease free. d3 = 1 if dead or relapsed,…

Heidi
- 25
- 5
0
votes
0 answers
Post-hoc pairwise
I'm trying to conduct a post-hoc (multiple comparison) analysis on the data (bmt), (KMsurv) and focusing on the variables t2 and d3 only.
Here is the code used:
library(KMsurv)
data(bmt)
bmt
library(survival)
# run the ANOVA and print out the ANOVA…

Heidi
- 25
- 5
0
votes
0 answers
Testing the hypothesis that there is no difference in survival between groups
I am trying to test the hypothesis that there is no difference in survival between the four groups in the data (kidney), reported on the death times of 863 kidney transplant patients. Where patients can be classified by race and sex into one of four…

Heidi
- 25
- 5