cox-regression

Python 2.7 - Rpy2 Cox Proprotional Hazards Model

我是研究僧i 提交于 2019-12-24 00:15:50
问题 I am using Python 2.7 on Mac OSX Lion and will be installing rpy2 to use Cox Proportional Hazards Model I was just wondering: has anybody used rpy2 to do Cox Proportional Hazards before. I was reading some of the documentation on the rpy2 package and it mostly talks about creating dataframes and such, as opposed to stating how various functions can be run. So, how would I go about calling this function and then specifying the dependent time variable , as well as the censoring variable

Plotting predicted survival curves for continuous covariates in ggplot

我是研究僧i 提交于 2019-12-23 19:58:40
问题 How can I plot survival curves for representative values of a continuous covariate in a cox proportional hazards model? Specifically, I would like to do this in ggplot using a "survfit.cox" "survfit" object. This may seem like a question that has already been answered, but I have searched through everything in SO with the terms 'survfit' and 'newdata' (plus many other search terms). This is the thread that comes closest to answering my question so far: Plot Kaplan-Meier for Cox regression In

How to plot a Cox hazard model with splines

只愿长相守 提交于 2019-12-20 16:21:31
问题 I have a following model: coxph(Surv(fulength, mortality == 1) ~ pspline(predictor)) where is fulength is a duration of follow-up (including mortality), predictor is a predictor of mortality. The output of the command above is this: coef se(coef) se2 Chisq DF p pspline(predictor), line 0.174 0.0563 0.0562 9.52 1.00 0.002 pspline(predictor), nonl 4.74 3.09 0.200 How can I plot this model so that I get the nice curvy line with 95% confidence bands and hazard ratio on the y axis? What I am

How to plot a Cox hazard model with splines

核能气质少年 提交于 2019-12-20 16:21:20
问题 I have a following model: coxph(Surv(fulength, mortality == 1) ~ pspline(predictor)) where is fulength is a duration of follow-up (including mortality), predictor is a predictor of mortality. The output of the command above is this: coef se(coef) se2 Chisq DF p pspline(predictor), line 0.174 0.0563 0.0562 9.52 1.00 0.002 pspline(predictor), nonl 4.74 3.09 0.200 How can I plot this model so that I get the nice curvy line with 95% confidence bands and hazard ratio on the y axis? What I am

coxph() X matrix deemed to be singular;

核能气质少年 提交于 2019-12-18 14:45:52
问题 I'm having some trouble using coxph(). I've two categorical variables:"tecnologia" and "pais", and I want to evaluate the possible interaction effect of "pais" on "tecnologia"."tecnologia" is a variable factor with 2 levels: gps and convencional. And "pais" as 2 levels: PT and ES. I have no idea why this warning keeps appearing. Here's the code and the output: cox_AC<-coxph(Surv(dados_temp$dias_seg,dados_temp$status)~tecnologia*pais,data=dados_temp) Warning message: In coxph(Surv(dados_temp

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",

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

What does is.na() applied to non-(list or vector) of type 'NULL' mean?

孤街浪徒 提交于 2019-12-10 02:44:07
问题 I want to select a Cox model with the forward procedure from a data.frame with no NA. Here is some sample data: test <- data.frame( x_1 = runif(100,0,1), x_2 = runif(100,0,5), x_3 = runif(100,10,20), time = runif(100,50,200), event = c(rep(0,70),rep(1,30)) ) This table has no signification but if we try to build a model anyway : modeltest <- coxph(Surv(time, event) ~1, test) modeltest.forward <- step( modeltest, data = test, direction = "forward", scope = list(lower = ~ 1, upper = ~ x_1 + x_2

R - model.frame() and non-standard evaluation

穿精又带淫゛_ 提交于 2019-12-07 07:43:34
问题 I am puzzled at a behaviour of a function that I am trying to write. My example comes from the survival package but I think that the question is more general than that. Basically, the following code library(survival) data(bladder) ## this will load "bladder", "bladder1" and "bladder2" mod_init <- coxph(Surv(start, stop, event) ~ rx + number, data = bladder2, method = "breslow") survfit(mod_init) Will yield an object that I am interested in. However, when I write it in a function, my_function

Adding column of predicted Hazard Ratio to dataframe after Cox Regression in R

亡梦爱人 提交于 2019-12-07 04:53:00
问题 I need to add columns of predicted hazard ratio in the dataframe after running Cox PH regression in R. The dataframe is a panel data where numgvkey if firm identifier and age is time identifier. You can download a small section of the date from this link: https://drive.google.com/file/d/0B8usDJAPeV85VFRWd01pb0h1MDA/view?usp=sharing I have don the following: library(survival) library(readstata13) sme <- read.dta13("sme.dta") reg<-coxph(Surv(age,EVENT2)~L1FETA+frailty(numgvkey), ties=c("efron")