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
Getting cumulative risk values
Consider the following toy example:
use https://data.princeton.edu/pop509/justices2.dta, clear
stset tenure, fail(event == 1)
stcrreg age year, compete (event == 2)
stcurve, cif
I want to plot a cumulative incidence curve as done above but then I…

bvowe
- 3,004
- 3
- 16
- 33
0
votes
1 answer
How many bootstraps does rfsrc in the R package randomforestsrc peform?
Does anyone know how many bootstraps or subsamples a standard call to rfsrc performs?
rf1<-rfsrc(Surv(time,status)~., data=myTable)
Also rf1$err.rate which is described as "cumulative OOB error rate" for me at the above settings is a vector of…

StanW
- 93
- 5
0
votes
0 answers
add pointwise confidence interval to prediction of survival curve plot
I have a data set of patients on a waiting list for an organ transplant. Event is death time. The set containts the following variables: patientID, time, status , age, gender, bmi, disease. I made a model of the survival time of a patient on the…

Dries De Witte
- 1
- 1
0
votes
0 answers
How to calculate the survival function in R for a glmnet cox family?
I have a sample data of 583 type 2 diabetes patients and want to calculate the 5 year incidence probability of an event for every patient. Variables which were collected are time to an event variable censored at 5 years, event status and 38…

Faiz Yusufi
- 1
- 2
0
votes
1 answer
How to add arrows to forest plot in survminer (ggforest)
I was wondering if there was a way to add two arrows to the x-axis of a forest plot, similar to what is shown in this example: How to add arrows to a forest plot? (this code does not work on ggforest)
Here is the sample…

Megan
- 3
- 1
- 2
0
votes
1 answer
Why does survey weight change R SQUARED?
library(survival)
library(survminer)
library(dplyr)
ovarian=ovarian
ovarian$weighting = sample(1:100,26,replace=T)
fitWEIGHT <- coxph(Surv(futime, fustat) ~ age + rx,data=ovarian,weight=weighting)
fitNOWEIGHT <- coxph(Surv(futime, fustat) ~ age +…

bvowe
- 3,004
- 3
- 16
- 33
0
votes
1 answer
How can I visualize an interaction in cox model in r?
I fitted a model and had a significant interaction effect. How can I plot this in a graphic?
It follows a toy example (only for illustration purposes):
library(survival)
# includes bladder data set
library(survminer)
fit2 <- coxph(Surv(stop, event)…

Guilherme Parreira
- 944
- 9
- 29
0
votes
2 answers
Reshape Data based on Different columns
I need to reshape my data, to get it in a proper format for Survival Analysis.
My current Dataset looks like this:
Product_Number Date Status
A 2018-01-01 0
A 2018-01-02 …

R overflow
- 1,292
- 2
- 17
- 37
0
votes
1 answer
Coxph long format issues errors
I have my data in long format correctly yet when I run the coxph function:
tryu <- coxph(Surv(entry,exit,dead==1) ~ age, na.action=na.omit,data=finalmerge)
I get the following error:
Warning message:
In Surv(entry, exit, dead == 1) :
Stop time…

user5298556
- 9
- 1
0
votes
0 answers
How can I plot standard distributions fit with survreg()?
I can not plot logistic or gaussian distributions fit to my data.
I load my data and create a survreg object
gbcs <- read.csv("https://ryanwomack.com/data/gbcs.csv")
recsurv <- Surv(rectime,censrec, gbcs)
If I try to fit a exponential distribution,…

Fidel Alencar
- 61
- 6
0
votes
1 answer
Feature selection in mlr using univariate.model.score filter on censored data
I am trying to perform feature selection in R using mlr and the univariate.model.score filter. In the documentation it says that surv.rpart is the default learner for this filter. My dataset contains censored survival data and I would like to use a…

panda
- 821
- 1
- 9
- 20
0
votes
0 answers
Proc Phreg Baseline Statement Equivalent in R
Is there a way to generate a table similar to the output of the baseline statement in SAS' proc phreg. Specifically, I want baseline harzards and survival probabilities at several time points for all combinations of the covariate set.

user1916067
- 127
- 1
- 11
0
votes
1 answer
Creating a function passing its arguments to the Surv function (or any other)
Please consider the following:
To create a survival curve one can make use of the survfit function of the survival package.
My aim is to write a function that (amongst other things) creates such a curve, but the function should work with different…

Frederick
- 810
- 8
- 28
0
votes
1 answer
Extimate prediction accuracy of cox ph
i would like to develop a cox proportional hazard model with r, use it to predict input and evaluate the accuracy of the model. For the evaluation I would like to use the Brior score.
# import various packages, needed at some point of the…

User12547645
- 6,955
- 3
- 38
- 69
0
votes
0 answers
Formatting data for survival analysis - time variable in long form data
I'm new to survival analysis, and am unsure if I'm formatting my data correctly.
Using this dummy data:
id <- c(rep("1", 10), rep("2", 10), rep("3", 10), rep("4", 10), rep("5", 10))
age <- c((15:24), (35:44), (45:54), (55:64), (40:49))
event <-…

T.P.
- 87
- 1
- 6