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.
Questions tagged [cox-regression]
476 questions
19
votes
1 answer
R coxph() warning: Loglik converged before variable
I'm having some trouble using coxph().
I've two categorical variables: Sex and Probable Cause, that I want to use as predictor variables. Sex is just the typical male/female but Probable Cause has 5 options.
I don't know what is the problem with the…

JMarcelino
- 904
- 4
- 13
- 30
14
votes
1 answer
coxph() X matrix deemed to be singular;
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.…

JMarcelino
- 904
- 4
- 13
- 30
13
votes
1 answer
What does is.na() applied to non-(list or vector) of type 'NULL' mean?
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…

Vincent
- 955
- 2
- 15
- 32
10
votes
3 answers
Cox regression python
Are there any packages in Python for survival analysis? Specifically, I am interested in performing a Cox regression?
I know this example but it's in R. Could we just interface Python with R (using, for example, rpy2)?

Edward
- 4,443
- 16
- 46
- 81
8
votes
0 answers
How to handle Recurrent event Survival analysis (Counting Process Approach) in Python
I am trying to find a way to model Survival Models for Recurrent Events in Python, especially the Counting process approach using CoxPH. In Counting Process Approach, it is expecting start-time and stop-time. But the fit method of CoxPHFitter in…

B K
- 723
- 8
- 17
8
votes
3 answers
Plot Kaplan-Meier for Cox regression
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…

Hims
- 103
- 1
- 1
- 5
7
votes
1 answer
Plotting estimated HR from coxph object with time-dependent coefficient and splines
I want to plot the estimated hazard ratio as a function of time in the case of a coxph model with a time-dependent coefficient that is based on a spline term. I created the time-dependent coefficient using function tt, analogous to this example that…

half-pass
- 1,851
- 4
- 22
- 33
7
votes
1 answer
Pooling Cox PH results after multiple imputation with the MICE package
I have a dataset with survival data and a few missing covariates. I've successfully applied the mice-package to imputate m-numbers of datasets using the mice() function, created an imputationList object and applied a Cox PH model on each m-dataset.…

Kjetil Loland
- 83
- 1
- 4
6
votes
2 answers
Cox regression output in xtable - choosing rows/columns and adding a confidence interval
I wan't to export the output from a cox regression to a table that I then can put into my article. I guess the best way to go about it is with xtable:
library(survival)
data(pbc)
fit.pbc <- coxph(Surv(time, status==2) ~ age + edema + log(bili) +
…

Max Gordon
- 5,367
- 2
- 44
- 70
6
votes
1 answer
Violation of PH assumption
Running a survival analysis, assume the p-value regarding a variable is statistically significant - let's say with a positive association with the outcome. However, according to the Schoenfeld residuals, the proportional hazard (PH) assumption has…

Slouei
- 716
- 7
- 19
6
votes
3 answers
Error in aeqSurv(Y) : aeqSurv exception, an interval has effective length 0
I'm using R's coxph function to fit a survival regression model, and I'm trying to model time dependent covariates (see this vignette). When fitting the model, I get the following error:
Error in aeqSurv(Y) :
aeqSurv exception, an interval has…

Adam Haber
- 683
- 1
- 6
- 8
6
votes
1 answer
How to model interaction of covariate with time when proportionality assumption is violated in survival analysis in R
In R, what is the best way to incorporate the interaction term between a covariate and time, when the proportionality test (with coxph) shows that the proportionality assumption in the Cox model is violated? I know that you can either use strata or…

B.Z.
- 61
- 1
- 6
6
votes
2 answers
How does cox.zph deal with time-dependent covariates?
I have a coxph model with 5 time-dependent and 2 time-independent variables. I want to test the proportional hazards assumption and besides martingale and deviance residuals, using cox.zph. My question is, how does this function deal with…

JMarcelino
- 904
- 4
- 13
- 30
5
votes
0 answers
Time-Dependent Cox Model
Consider the attached (dummy) sample csv file where two methods (i.e. Method A and Method B) are used to evaluate time to progression (PFS) in cancer patients. For each patient we also have the overall survival (OS).
data available as CSV from…

user86533
- 323
- 1
- 7
- 18
5
votes
1 answer
NA/NaN/Inf in foreign function call (arg 5)
I don't know if I need to get rid of some data, or what is going on here.
Models 1 and 2 work perfectly fine. Model 3 won't run.
model1 <- clogit(Used ~ Slope + strata(OBJECTID), data=old)
model2 <- clogit(Used ~ Aspect + strata(OBJECTID),…

Dan Graham
- 61
- 1
- 5