survival-analysis

Error using survSplit function

两盒软妹~` 提交于 2019-12-12 23:15:39
问题 I'm rerunning code from 2 years ago and am encountering a new error with the survSplit function. The error says that my object cannot be found, even though it is a defined column in my dataframe. Here is an example of my dataframe: f12 <- data.frame(id = 1:6, next.ivl= c(22.348, 1.837, 2.051,1.782,1.692, 1.730), event = c(0,1,1,0,1,1), enter= rep(0,6), end=c(22.348, 1.837,2.051,1.782,1.629,1.730)) My previous code was the following: cutpoints.l <- c(10/12, 1.25, 1.75, 2.25, seq(3,11)) f12

Estimating prediction accuracy of a Cox survival model using sbrier (R)

南笙酒味 提交于 2019-12-12 23:12:01
问题 The integrated Brier score (IBS) has been suggested in a paper by Graf et al (1999) as a good measure for prediction accuracy in survival models (see e.g. overview paper by Wiering et al., page 23). It was implemented in the package ipred as function sbrier . However, whereas the brier score definition obviously applies to Cox proportional hazard models, I cannot get sbrier to return the Brier score for a coxph model. Here is the problem set up. library(survival) library(ipred) data("DLBCL",

“Wrong number of args for this type of survival data” when coding a survival object in R

牧云@^-^@ 提交于 2019-12-12 22:20:20
问题 I'm experiencing the above error message when trying to run a survival analysis with Weibull distribution, in R. My data is a bit tricky in that it contains both left and right censored observations. I followed instructions found on https://stat.ethz.ch/R-manual/R-devel/library/survival/html/Surv.html: "Interval censored data can be represented in two ways. For the first use type = "interval" and the codes shown above. In that usage the value of the time2 argument is ignored unless event=3.

How do I extract hazards from survfit in R?

烂漫一生 提交于 2019-12-12 08:45:25
问题 I have a survfit object. A summary survfit for my t=0:50 years of interest is easy enough. summary(survfit, t=0:50) It gives the survival at each t. Is there a way to get the hazard for each t (in this case, the hazard from t-1 to t in each t=0:50)? I want to get the mean and confidence interval (or standard error) for the hazards relating to the Kaplan Meier curve. This seems easy to do when a distribution is fit (eg. type="hazard" in flexsurvreg ) but I can't figure out how to do this for a

Plot Kaplan-Meier for Cox regression

杀马特。学长 韩版系。学妹 提交于 2019-12-12 08:38:50
问题 I have a Cox proportional hazards model set up using the following code in R that predicts mortality. Covariates A, B and C are added simply to avoid confounding (i.e. age, sex, race) but we are really interested in the predictor X. X is a continuous variable. cox.model <- coxph(Surv(time, dead) ~ A + B + C + X, data = df) Now, I'm having troubles plotting a Kaplan-Meier curve for this. I've been searching on how to create this figure but I haven't had much luck. I'm not sure if plotting a

Management of spell data: months spent in given state in the past 24 months

非 Y 不嫁゛ 提交于 2019-12-12 04:45:00
问题 I am working with a spell dataset that has the following form: clear all input persid start end t_start t_end spell_type year spell_number event 1 8 9 44 45 1 1999 1 0 1 12 12 60 60 1 2000 1 0 1 1 1 61 61 1 2001 1 0 1 7 11 67 71 1 2001 2 0 1 1 4 85 88 2 2003 1 0 1 5 7 89 91 1 2003 2 1 1 8 11 92 95 2 2003 3 0 1 1 1 97 97 2 2004 1 0 1 1 3 121 123 1 2006 1 1 1 4 5 124 125 2 2006 2 0 1 6 9 126 129 1 2006 3 1 1 10 11 130 131 2 2006 4 0 1 12 12 132 132 1 2006 5 1 1 1 12 157 168 1 2009 1 0 1 1 12

Plotting a survival curve from a survreg prediction

微笑、不失礼 提交于 2019-12-12 04:12:16
问题 I'm relatively new to survival analysis and have been used some standard telco churn data example with a sample below called 'telco': telco <- read.csv(text = "State,Account_Length,Area_Code,Intl_Plan,Day_Mins,Day_Calls,Day_Charge,Eve_Mins,Eve_Calls,Eve_Charge,Night_Mins,Night_Calls,Night_Charge,Intl_Mins,Intl_Calls,Intl_Charge,CustServ_Calls,Churn IN,65,415,no,129.1,137,21.95,228.5,83,19.42,208.8,111,9.4,12.7,6,3.43,4,TRUE RI,74,415,no,187.7,127,31.91,163.4,148,13.89,196,94,8.82,9.1,5,2.46,0

Stuck with package example code in R - simulating data to fit a model

十年热恋 提交于 2019-12-12 01:42:28
问题 I am trying to understand the function indeptCoxph in the spBayesSurv package. This function fits a Bayesian proportional hazards model. I am getting a little stuck with understanding parts of the R code as well as the Cox model theory. I am working on the authors' example (below). They have first simulated survival time data and I am having trouble following their code for doing this. It seems to me that first they are simulating survival times from an exponential distribution with CDF F(t)

Is it possible to run a Cox-Proportional-Hazards-Model with an exponential distribution for the baseline hazard in `lifelines` or another package?

老子叫甜甜 提交于 2019-12-11 15:54:04
问题 I consider using the lifelines package to fit a Cox-Proportional-Hazards-Model. I read that lifelines uses a nonparametric approach to fit the baseline hazard, which results in different baseline_hazards for some time points (see code example below). For my application, I need an exponential distribution leading to a baseline hazard h0(t) = lambda which is constant across time. So my question is: is it (in the meantime) possible to run a Cox-Proportional-Hazards-Model with an exponential

How to deal with violation of proportional hazards assumption in Cox PH, R 3.1.3 survfit

和自甴很熟 提交于 2019-12-11 13:55:02
问题 I'm performing survival analysis in R using the 'survival' package and coxph . My goal is to compare survival between individuals with different chronic diseases. My data are structured like this: id, time, event, disease, age.at.dx 1, 342, 0, A, 8247 2, 2684, 1, B, 3879 3, 7634, 1, A, 3847 where 'time' is the number of days from diagnosis to event, 'event' is 1 if the subject died, 0 if censored, 'disease' is a factor with 8 levels, and 'age.at.dx' is the age in days when the subject was