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
1 answer

Survival analysis in ggplot in R

I coded the following (I used data=lung) library(ggsurvfit) library(ggplot2) p <- survfit2(Surv(time, status)~sex, data=lung) ggsurvfit(p, type = "survival" ) add_censor_mark() %>% add_confidence_interval()…
user19745561
  • 145
  • 10
0
votes
1 answer

flexsurvreg Error in `[.default`(Y, , "time") : subscript out of bounds

Given the following data from the Surv function, and trying to fit a model using flexsurvreg I'm getting an error stating: Error in [.default(Y, , "time") : subscript out of bounds I'm not sure why this error is occurring. I must be something to…
Jake
  • 510
  • 11
  • 19
0
votes
1 answer

Error in survival::survdiff(eval(fit$call$formula), data = data) : Right censored data only

I'm encountering a problem similar to Survival not recognizing right censored data but the suggested fix isn't working. I've confirmed that the censoring variable is numeric and I'm not encountering any problems when using coxph function. I only get…
0
votes
0 answers

Landmark survival analysis

Please modify the code so that it includes "table at risk" under each KM curve (i.e., for each landmark set). library(survival) library(tidyverse) mod1 - survfit (Surv(time, status) ~ sex, data = lung) df <- as.data.frame(unclass(mod1)[c(2:7,…
0
votes
2 answers

Ggsurvplot doesn't work and the basic plot of the survival curve shows the cumulative hazard plot instead

for a project I'm conducting a survival analysis in R on two datasets analysing how much survival time depends on some blood biomarkers; one was used for development and one for validation. The problem is when I try to launch the plots of the…
0
votes
0 answers

Different results from predict() function and manual calculations of cox model

I have a cox model with variables of age, living environment, Rankin, side of stroke, and systolic blood pressure. Summary of model is: coef exp(coef) se(coef) z p age 0.061691 1.063634 …
0
votes
0 answers

ggsurvplot return error: arguments imply differing number of rows

I use ggsurvplot to generate survival plots and encountered problems when my Surv fit function includes multiple censored data. This is the data link: testdata my fit function and my ggsurvplot…
0
votes
1 answer

Function to return survival (survfit) and kaplan-meier (ggsurvplot) given a list or vector of dependent variables

Given a data frame in R with different columns that could work as dependent variables, I'm trying to create a function that receives the data frame 'df', list or vector with dependent variables 'vars', a time variable 'time' and a status variable…
Allan
  • 321
  • 1
  • 8
0
votes
0 answers

Is it possible to predict survival object (time + event) in survival model?

I'm wondering Is it possible to predict survival object (time + event) in survival model? Also, if it is, is it possible to use Brier's score to measure a single person rather rhan a overal model? Because if we can predict the survival object, we…
0
votes
1 answer

Apply LASSO in R using glmnet package for cox model

I want to perform LASSO for cox ph model in R for variable selection. Somewhere, I found this code and done my analysis, somewhere else I found it is for elastic net, someone please confirm I am using the right code. lasso<- cv.glmnet(xmat, ysurv,…
Basheer
  • 7
  • 2
0
votes
0 answers

Kaplan Meier curve

I'm working on survival analysis from my dataset. My question is : Is there a function in survminer or ggplot package that make the survival curve style look like Stata output (as if it's created by stata software)? Thanks in advance.
0
votes
0 answers

Issue with parenting networked objects (Unity Mirror)

So I've been making this online survival game using mirror and I have come across an issue with spawning in a weapon for the player. Apparently you can only parent an object to another networked object (when executed by the server). When I was doing…
0
votes
1 answer

Kaplan-Meier Survival curve with 3 Plots

I am very new to R studio, and I am currently learning how to do Kaplan-Meier survival curves. Here are the columns that are needed and the information the columns contain: Group: “normal”, “high” Response: “responder” “non-responder” Days: this is…
Maze
  • 1
0
votes
0 answers

Survival analysis in R

I am trying to do a survival analysis on R. I installed survival, survminer, and dplyr functions. Then I run library(survival) and library(survminer). After executing the command I found this Loading required package: ggplot2 Need help getting…
0
votes
0 answers

R : does `predict` still center linear predictors of categorical variables?

Until then, to obtain the linear predictors of a Cox model via predict, it was accepted that the linear predictors were centred. When they were recalculated, the continuous and categorical variables were centered (see Linear predictor from…