Questions tagged [cox-regression]

The term Cox regression model (omitting proportional hazards) is sometimes used to describe the extension of the Cox model to include time-dependent factors. However, this usage is potentially ambiguous since the Cox proportional hazards model can itself be described as a regression model.

476 questions
2
votes
1 answer

Understand colors in R survfit.plot function for a coxph model

I'm trying to create a set of univariate coxph models, with categorical explanatory variables and, for each model, I would like to comapre the survival functions by level of variable. For example I'm creating: library(survival) set.seed(4321) data…
botti23
  • 71
  • 1
  • 6
2
votes
0 answers

lifelines/scikit-survival: Calculation of the expected times

I am trying to understand how to calculate the expected time for the each of my ids in my dataset. I have a dataset that looks like a Dataframe shaped (500,4): ids var1 var2 churn time 0 1.738434 324 0 21.0 1 1.541176 …
2
votes
1 answer

Export Cox regression results to excel or word using publish package

Looking at the code below library(pec) data(GBSG2,package="pec") setDT(GBSG2) GBSG2 library(survival) library(prodlim) library(Publish) cox_lung <-…
Allan
  • 321
  • 1
  • 8
2
votes
0 answers

R coxph returns NA for time-varying covariate

I am using coxph to estimate the effect of a time-varying variable (tvc) on a survival event (event). Following the several instructions on the Internet (considering tmerge), I prepared the data (df) as: id country start stop event endpoint…
2
votes
0 answers

Error when testing the cox proportional hazard assumption with a frailty term

I am trying to evaluate the proportional hazard assumption of a Cox PH model that includes both an interaction term and a frailty term. When I call cox.zph, I get this error: Error in imatr[kk, kk] : subscript out of bounds I don't get the error…
momce
  • 21
  • 1
2
votes
0 answers

Is there a way to assess proportional hazards with the tt() function in the survival package currently?

I know that in the survival package, you are able to define a function which allows you to transform time in the event that you have a covariate that violates proportional hazards. However, in the documentation I've seen, you should be able to run a…
Ryan
  • 77
  • 7
2
votes
2 answers

How to get the wald test of a specific variable in a multivariate Coxph?

I fitted a multivariate Cox model using the R survival package like follow: library(survival) data(lung) res.cox1 <- coxph(Surv(time, status) ~ sex + ph.karno + wt.loss, data = lung) res.cox1 Call: coxph(formula = Surv(time, status) ~ sex +…
2
votes
1 answer

Deviance and Score Residual plots

I'm trying to plot the Deviance and Score residual plots on the data(kidtran) for Proportional hazard model. 1- I've attempted to plot the Deviance Residual plot for coxph model with the covariates (race , gender and gender by race interaction)…
Dana
  • 75
  • 5
2
votes
1 answer

Cox proportional hazard model

I am trying to run Cox proportional hazard model on a data of 4 groups. Here's the data: I am using this code: time_Allo_NHL<- c(28,32,49,84,357,933,1078,1183,1560,2114,2144) censor_Allo_NHL<- c(rep(1,5), rep(0,6)) time_Auto_NHL<-…
Dana
  • 75
  • 5
2
votes
1 answer

Solving Cox Proportional Hazard after creating interaction variable with time

I am using lifelines package to do Cox Regression. After trying to fit the model, I checked the CPH assumptions for any possible violations and it returned some problematic variables, along with the suggested solutions. One of the solution that I…
2
votes
2 answers

Is there a way to manually change label colors in nomogram drawn with the rms-package?

Please, find my data sample pp below. Question: is there a way to change the color of the encircled label text in the nomogram shown below? As you can see, I encircled three different parts which I would like to change manually. I have not found a…
cmirian
  • 2,572
  • 3
  • 19
  • 59
2
votes
1 answer

how can i extract baseline hazards from a coxPHFitter function in Lifelines and the coefficients for my variates

Below is the sample code I got from the documentation website. I want to access the baseline hazards and the coefficients of the variates. ''' from lifelines import CoxPHFitter from lifelines.datasets import load_rossi rossi_dataset =…
2
votes
0 answers

"arguments imply differing number of rows: 0, 1" error in tab_model, package sjPlot

I'm stumped here and hoping that someone can help me out. I'm running a crude Cox PH model for a dichotomous predictor ("base_factor") and time of death. The modelruns without errors and the results can be displayed with summary(), as well as…
2
votes
1 answer

cox regression output table or plot in R

I have a Cox regression which employs strata() and a tt(). Is there any package which helps to produce a well looking, informative output of the results in table format? While ggforest()handles tt()it does not handle strata() I am looking for any…
Juan
  • 171
  • 1
  • 12
2
votes
1 answer

R - cox.zph() not returning rho values, p-values differ from examples

When I run cox.zph on a Cox model, I get a different type of return than I am seeing everywhere else. I tried running the following code: library(survival) #version 3.1-7 library(survminer) #version 0.4.6 res.cox <- coxph(Surv(time, status) ~ age +…
shwalters
  • 23
  • 4