Questions tagged [cox]
67 questions
4
votes
0 answers
How to draw a forest plot for coxph considering subject ids in R?
I am trying to draw a forest plot for the results of cox model with repeated measures considering subjects ids; here is a part of my big data;
data <- read.table(header=TRUE, text="
Id start end QS Age Event
01 0 70 1 25 …

Katie
- 119
- 1
- 7
4
votes
1 answer
Xgboost cox survival time entry
In the new implementation of cox ph survival model in xgboost 0.81 how does one specify start and end time of an event?
Thanks
The R equivalent function would be for example :
cph_mod = coxph(Surv(Start, Stop, Status) ~ Age + Sex + SBP, data=data)

aiedu
- 133
- 2
- 11
3
votes
2 answers
Export coxph summary from R to csv
How to export summary of cox_proportional hazard model from R to csv. I ran a test by function coxph.
by survival package
Now i want to export its summary to csv, how to do that.
c <- coxph(Surv(x~y))
summary(c)

Aryh
- 479
- 1
- 4
- 16
3
votes
1 answer
R coxme: How to get study-specific treatment effect and 95% confidence interval from a mixed effect model?
I am using the coxme to fix a mixed effect Cox model. I have two random effects in the model (intercept [baseline hazard] and slope of the treatment). After running the model, I got the fixed coefficients and random effects output:
Fixed…

JeffJR
- 31
- 3
3
votes
0 answers
Compare fit Cox models with a cluster() element in R
I would like to compare the model fits of Cox proportional-hazards models with a likelihood-ratio test (or equivalent). This usually works by comparing the fit with the anova() function. However, when I have data that is organized in clusters and…

RmyjuloR
- 369
- 1
- 4
- 13
3
votes
1 answer
What is the default of the time transform function in the coxph command?
Short introduction:
A Cox Proportional Hazards (PH) model can be estimated with the coxph function of the survival package. An obvious requirement to get sensible results from this type of model is that the hazards are proportional, i.e., they are…

StatMan
- 596
- 1
- 6
- 13
2
votes
1 answer
How to reproduce Cox survival model results from Stata in R?
I am attempting to reproduce in R Cox survival model results originally obtained in Stata. Here is the Stata code:
stset t, id(leadid) failure(c_coup)
stcox legislature lgdp_1 growth_1 exportersoffuelsmainlyoil_EL2008 ethfrac_FIXED communist mil…

w5698
- 159
- 7
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…

Alberto Grassi
- 21
- 2
2
votes
2 answers
ggforest returns error Error in `[.data.frame`(cbind(allTermsDF, coef[inds, ]), , c("var", "level", : undefined columns selected
I am using the ovarian dataset from the survival package using the following standard code:
ovarian$rx <- factor(ovarian$rx, levels = c("1", "2"), labels = c("A", "B"))
ovarian$resid.ds <- factor(ovarian$resid.ds, levels = c("1", "2"), labels =…

Nora_R
- 51
- 5
2
votes
2 answers
Cox regression with Inverse Propensity Treatment Weighting
A normal Cox Regression is as following:
coxph(formula = Surv(time, status) ~ v1 + v2 + v3, data = x)
I've calculated the Inverse Propensity Treatment Weighting (IPTW) scores with the subsequent Propensity Scores.
Propensity scores can be…

Kweetvannix
- 61
- 1
- 10
2
votes
2 answers
R coxph() Error: object 'Ccoxmart' not found
I am getting the following error every time I run a Cox model using the survival package in R. This error arose within the last few days. To illustrate the error, I am using a standard example command which is given at…

user3487564
- 149
- 1
- 6
1
vote
1 answer
How to resolve an issue of large confidence intervals while running CoxPH analysis in R?
I am running into an issue while performing CoxPH analysis using the following sample dataset:
structure(list(Systemic.Tx...2.classification..Chemotherapy..PD1.monotherapy..PD.1.CTLA.4.combo..PD.1.chemo..targetted.Tx..targetted.chemo.combo..etc.
=…

Adam
- 59
- 8
1
vote
0 answers
spss query HRs for time dependent covariate at multiple periods of follow-up
Consider the model: h(t, X) = h0(t) exp [clin2 + prison + dose + clin2gt] where the variables are defined as follows: clin2 is time dependent (categorical coded 1/0); survt follow-up time in days; clin2gt is the clin2*time interaction; Prison is…

Anthony Cutajar
- 11
- 1
1
vote
1 answer
R modelsummary output: robust standard errors from coxph model
Im running a series of coxph models in R and compiling the output into latex tables using the modelsummary package and command. The coxph provides SE and robust se as outputs and the p-value is based on the robust se. Here is a quick example to…

dmort
- 181
- 1
- 11
1
vote
1 answer
How can I change coef to exp(coef) in modelsummary table?
I am trying to create a summary table for my Cox model. However, when I use modelsummary function, it gives me a table that shows coef. But I want to display exp(coef) on my summary table. How can I change coef to exp(coef)?
I use this script to…

hobsbawm
- 21
- 5