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
5
votes
2 answers
R - model.frame() and non-standard evaluation
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…

Theodor
- 986
- 3
- 7
- 23
5
votes
1 answer
Adding column of predicted Hazard Ratio to dataframe after Cox Regression in R
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…

Jairaj Gupta
- 347
- 4
- 16
5
votes
1 answer
How can I add p-value to my concordance index plot in R?
In my survival analysis task, I have used cox proportional model to calculate concordance index (c-index) value in different groups of my dataset.
I was wondering how can I add p-value to my c-index plot to compare different groups to look like this…

user3576287
- 932
- 3
- 16
- 30
5
votes
1 answer
How to plot a Cox hazard model with splines
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:
…

Oposum
- 1,155
- 3
- 22
- 38
5
votes
1 answer
Can I perform all subsets variable selection for a Cox Proportional Hazards Model in R?
I am trying to use a function similar to, if not actually, regsubsets in the leaps package in program R when selecting the top Cox Proportional Hazards models for my data. Is this possible? and if so does a function already exist?

marcellt
- 501
- 5
- 14
4
votes
2 answers
Predicting and Plotting Survival Curve with the CoxPH
I am trying to predict and plot the (estimated) survival curve for a new observation in R. Using the "survival" library and the "lung" data set, I first fit a cox proportional hazards model to the data. Then, I tried to predict and plot the survival…

stats_noob
- 5,401
- 4
- 27
- 83
4
votes
0 answers
Why coxph() results some of the coefficient as NA when using survSplit() in R?
I'm working with survival data, and using survSplit() to deal with non-proportionality with time-dependent coefficients. The model is based on the article by Terry Therneau et. al. (2020)…

Vilponk
- 41
- 1
- 3
4
votes
3 answers
Computing SE or CI for ggadjustedcurves
How can I compute index of variability (SE or CI) for ggadjustedcurves from survminer function? I am using the conditional method. Anyone have any input or resource?

mindhabits
- 421
- 1
- 3
- 10
4
votes
2 answers
Feature (Covariates) selection in CoxPHFitter, Lifelines Survival Analysis
i am using this implemented model in Python for the purpose of survival analysis:
from lifelines import CoxPHFitter
Unfortunately i am not able(i do not know how) to loop over all covariates (features) to run the regression individualy for the…

Antonio Dichev
- 61
- 4
4
votes
1 answer
Create formula call from character string
I use a best subset selection package to determine the best independent variables from which to build my model (I do have a specific reason for doing this instead of using the best subset object directly). I want to programmatically extract the…

Todd Shannon
- 527
- 1
- 6
- 20
4
votes
1 answer
Parameter estimates and variance for stratified variables in Cox regression (strata / survival package)
I have run Cox regression using the survival package to calculate mortality hazard ratio of an exposure A. I have found that the age variable violated the proportional hazard assumption (with cox.zph) and used strata(age)to stratify age in further…

jeanphikri
- 63
- 1
- 4
4
votes
2 answers
Plotting predicted survival curves for continuous covariates in ggplot
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…

RNB
- 457
- 1
- 5
- 14
4
votes
2 answers
Machine learning models for predicting when some event will occur
Consider the problem where I need to predict when a particular event is going to occur based on the past data (data available with time stamp) available.
For example
Assume a particular machine is running and we have the data collected from that…

B K
- 723
- 8
- 17
4
votes
2 answers
How to predict survival time in Cox's Regression Model in R?
I have a modeled a problem using Cox's regression and now want to predict the estimated survival time for an individual. The model has a list of covariates on which the survival time depends. This tells us how to calculate P(T>t) which is basically…

statBeginner
- 829
- 2
- 9
- 23
4
votes
1 answer
Negative event times encountered; not permitted for Cox family
I am running a coxph model using glmnet. The following is the code that I am using:
data <- read.csv("CSM Tiers by Org.csv", stringsAsFactors = FALSE, na.strings = "?")
x <- model.matrix(~ data$CSM + data$Exclude + data$Queue)
y <- data$Time
status…

EsBee
- 231
- 2
- 13