survival-analysis

Why does Survival curve sum up to 100% when less than 50% experience event?

走远了吗. 提交于 2020-04-14 09:14:36
问题 This problem has confounded me for more hours than I care to admit. I have isolated the problem so I can replicate it. library(survival) library(survminer) set.seed(123) test <- data.frame(rnorm(10000)+5, sample(0:1, 10000, replace = TRUE)) colnames(test)<- c("time", "event") #sum(test$event) = 4975 survfitted <- survfit(Surv(time = time, event = event) ~ 1, data = test) plot(survfitted, fun = "event") Why does this curve sum up to 100% when only 49.75% experience an event? What would be the

String wrapping text data in risk table in surv_miner for ggplot2

*爱你&永不变心* 提交于 2020-03-05 05:04:44
问题 I have the following risk table for a Kaplan Meier curve constructed with surv_miner in RStudio: Kaplan Meier curve I would like to string wrap the text in the risk table so that the number is on top, and the percentage (in parenthesis) is on another line below the number, so that they all fit in the table. I tried using the stringr package, but I don't quite know how to incorporate that into the theme. Any help would be appreciated. I've posted just my code, since it is a bit tricky to add

unable to plot kaplan-meier curve with survfit object from a list using ggsurvplot

浪尽此生 提交于 2020-01-23 08:20:26
问题 I am trying to plot Kaplan-Meyer curve using ggsurvplot from survminer package. I'm unable to plot it when I pass a survfit object saved in a list. Let me use lung dataset as a example. Everything works below: library("survival") library("survminer") fit <- survfit(Surv(time, status) ~ sex, data = lung) ggsurvplot(fit, conf.int = TRUE, risk.table.col = "strata", palette = c("#E7B800", "#2E9FDF"), xlim = c(0, 600)) Now I do survfit on two variables and save the model result in a list. Then

R Survival Curve Plot Legend

萝らか妹 提交于 2020-01-15 10:43:59
问题 I have a table that looks like this: ID Survival Event Allele 2 5 1 WildType 2 0 1 WildType 3 3 1 WildType 4 38 0 Variant I want to do a kaplan meier plot, and tell me if wild type or variants tend to survive longer. I have this code: library(survival) Table <-read.table("Table1",header=T) fit=survfit(Surv(Table$Survival,Table$Event)~Table$Allele) plot(fit,lty=2:3,col=3:4) From the fit p value, I can see that the survival of these two groups have significantly different survival curves.

R Survival Curve Plot Legend

[亡魂溺海] 提交于 2020-01-15 10:43:29
问题 I have a table that looks like this: ID Survival Event Allele 2 5 1 WildType 2 0 1 WildType 3 3 1 WildType 4 38 0 Variant I want to do a kaplan meier plot, and tell me if wild type or variants tend to survive longer. I have this code: library(survival) Table <-read.table("Table1",header=T) fit=survfit(Surv(Table$Survival,Table$Event)~Table$Allele) plot(fit,lty=2:3,col=3:4) From the fit p value, I can see that the survival of these two groups have significantly different survival curves.

R Survival Curve Plot Legend

穿精又带淫゛_ 提交于 2020-01-15 10:43:05
问题 I have a table that looks like this: ID Survival Event Allele 2 5 1 WildType 2 0 1 WildType 3 3 1 WildType 4 38 0 Variant I want to do a kaplan meier plot, and tell me if wild type or variants tend to survive longer. I have this code: library(survival) Table <-read.table("Table1",header=T) fit=survfit(Surv(Table$Survival,Table$Event)~Table$Allele) plot(fit,lty=2:3,col=3:4) From the fit p value, I can see that the survival of these two groups have significantly different survival curves.

Mice pool() function and coxph(): in mice.df (…) : large sample assumend?

六月ゝ 毕业季﹏ 提交于 2020-01-13 18:05:14
问题 I used coxph() from the survival package in multiply imputed dataset and encountered a warning when trying to pool the results. The warning message states: "In mice.df(m, lambda, dfcom, method) : Large sample assumed. A reproducible example is below (with publically available data, without worrying to much about the appropriateness of using both mice and coxph is these data): library(mice) library(survival) #load publically available data data(pbc) #select variables for the reproducable

Mice pool() function and coxph(): in mice.df (…) : large sample assumend?

随声附和 提交于 2020-01-13 18:03:50
问题 I used coxph() from the survival package in multiply imputed dataset and encountered a warning when trying to pool the results. The warning message states: "In mice.df(m, lambda, dfcom, method) : Large sample assumed. A reproducible example is below (with publically available data, without worrying to much about the appropriateness of using both mice and coxph is these data): library(mice) library(survival) #load publically available data data(pbc) #select variables for the reproducable

How do I create a survival object in R?

六月ゝ 毕业季﹏ 提交于 2020-01-13 05:35:09
问题 The question I am posting here is closely linked to another question I posted two days ago about gompertz aging analysis. I am trying to construct a survival object, see ?Surv, in R. This will hopefully be used to perform Gompertz analysis to produce an output of two values (see original question for further details). I have survival data from an experiment in flies which examines rates of aging in various genotypes. The data is available to me in several layouts so the choice of which is up

Extract survival probabilities in Survfit by groups

别等时光非礼了梦想. 提交于 2020-01-10 09:05:27
问题 I am new to survival analysis and survfit in R. I want to extract survival probabilities for 4 groups (diseases) at specified time periods (0,10,20,30 years since diagnosis) in a table. Here is the setup: fit <- survfit((time=time,event=death)~group) surv.prob <- summary(fit,time=c(0,10,20,30))$surv surv.prob contains 16 probabilities, that is, survival probabilities for 4 groups estimated at 4 different time periods listed above. I want to create a table like this: Group time.period prob 1 0