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

Mean beta hat does not equal to true beta by sim.survdata

I recently use the R "sim.survdata" function in "coxed" package to simulate survival data. I did 2k simulations with one covariate and coefficient = 1. Each time I fitted a Cox regression and recorded the estimated beta and 95% CI. However the…
Weiyu Qiu
  • 11
  • 1
0
votes
0 answers

unexpected symbol in "tt" function for categorical variable

I have a dataset with time, event and 4 predictor variables of which "Q.V4" is a categorical variable which needs to be transformed using tt function. This variable has 4 levels - Q1, Q2, Q3, Q4 F1 <- data.frame( time=c(102,48,84,72,66,90), …
Biostats
  • 51
  • 8
0
votes
1 answer

Shiny scatterplot with real-time Kaplan-Meier

I have constructed an interactive scatterplot in Shiny. Using plotly, I can select groups of points and render the annotations for this group in a table next to the plot. library(survival) library(survminer) mtcars <-…
Matt
  • 5
  • 2
0
votes
2 answers

plot specific groups within strata in ggsurvplot

I wonder how I can plot only specific groups within a predefined strata. For instance in the examples below, how can I for instance plot only sex:0,rx:Obs against sex:1,rx:Obs as one specific survival-plot (not faceted), ignoring the other…
user2300940
  • 2,355
  • 1
  • 22
  • 35
0
votes
1 answer

How do I specify the layout of plots in ggcompetingrisks?

Below is a sample code: set.seed(2) failure_time <- rexp(100) status <- factor(sample(0:3, 100, replace=TRUE), 0:3, c('no event', 'death', 'progression','other')) disease <- factor(sample(1:6, 100,replace=TRUE), 1:6, …
kna123
  • 115
  • 8
0
votes
0 answers

Stratified Fisher and Wilcoxon test

I would like to perform a stratified fisher test. I've tried with tabulate without success. These are my data: > db$site [1] 2 2 2 3 1 1 1 1 1 1 1 1 1 1 2 3 1 1 1 1 1 1 1 1 2 2 3 3 1 1 3 1 2 1 1 2 1 1 1 1 1 3 1 1 1 1 1 3 1 [50] 2 1 1 3 3 3 1 1…
ArTu
  • 431
  • 4
  • 20
0
votes
0 answers

Actuarial vs. predicted survival comparison

I have a set of patients and their actuarial 1- and 5-years survival. I have also used their data with a certain commonly utilised medical score, that calcualtes survival probability for 1- and 5-years (for example 75% and 55% respectively). I'd…
opir
  • 1
0
votes
1 answer

Cox PH time-dependent covariate formatting in R

I am trying to perform a Cox proportional hazards analysis with a time-dependent covariate in R. I have read the relevant documentation (Therneau et al.) and several tutorials but am struggling to format my data properly given how the covariate is…
panbear
0
votes
2 answers

In cox regression categorical levels not shown in my output

In my data, Hemoglobin_group is a categorical variable with 6 levels. When I run the below code, I can't see Hemoglobin_group levels in the output. How can I solve this problem? fit <- coxph(Surv(Time,Status)~Hemoglobin_group, data) fit My output: …
Cgdmm
  • 63
  • 1
  • 7
0
votes
1 answer

How to interpret PySurvival's predict_survival output?

I've built a model using PySurvival's CoxPH model and then ran the predict_survival function to check its output. Here's a sample of the output it provides when printing the result of the predict_survival function after calling it with the following…
0
votes
1 answer

How to use use predict() for survreg models?

This is my model: library(eha) fit.aft <- aftreg(formula = Surv(time, status) ~ age + sex, data = kidney, dist = "lognormal") however this is what I see if I want to use predict: predict(fit.aft) Error in UseMethod("predict")…
David
  • 1
  • 1
0
votes
1 answer

How to know if the data is censored in a survival analysis using r

I have a data set that looks like this (a nonsense example): id <- c(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3) year <- c(1990, 1991, 1992, 1989, 1990, 1991, 1992, 1993, 1989, 1990, 1992, 1993) event<- c(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1) df <-…
johnny
  • 423
  • 3
  • 10
0
votes
1 answer

Survival anaylsis: parameters for concordance_index_censored (scikit-survival)

I want to implement concordance_index_censored on my test set, using the model I trained. I don't understand which should be my input into the estimate parameter in concordance_index_censored(). Is it somewhere in coxnet_pred? If not, where should I…
DoreenBZ
  • 328
  • 1
  • 8
0
votes
0 answers

R Error in grid.Call with survminer :: ggsurvplot with new packages versions

I use the ggsurvplot from survminer package in R to plot Kaplan-Meir curves. Here is the code and the following error: library(ggplot2) library(survival) library(survminer) km_fit_2cohorts <- survival::survfit(Surv(time_event_M, indic_Death) ~…
Clem
  • 5
  • 3
0
votes
1 answer

What is the R code for making a Kaplan Meier plot for how many people develop diabetes during 10 years when the data set includes info up to 25 years?

I struggle with R ....How do I cut out the observations from 10- 25 years to make a Kaplan meier plot for up to 10 years: what would I add to this line of code? Or would I Need to make separate groups for 0-1 year, 1-2 years and so on? km.model <-…
Murphy
  • 9
  • 3