cox-regression

Plotting estimated HR from coxph object with time-dependent coefficient and splines

送分小仙女□ 提交于 2019-12-06 01:48:39
问题 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 comes straight from ?coxph : # Fit a time transform model using current age cox = coxph(Surv(time, status) ~ ph.ecog + tt(age), data=lung, tt=function(x,t,...) pspline(x + t/365.25)) Calling survfit(cox) results in an error that survfit does not

Predict probability from Cox PH model

China☆狼群 提交于 2019-12-05 10:35:49
问题 I am trying to use cox model to predict the probability of failure after time (which is named stop) 3. bladder1 <- bladder[bladder$enum < 5, ] coxmodel = coxph(Surv(stop, event) ~ (rx + size + number) + cluster(id), bladder1) range(predict(coxmodel, bladder1, type = "lp")) range(predict(coxmodel, bladder1, type = "risk")) range(predict(coxmodel, bladder1, type = "terms")) range(predict(coxmodel, bladder1, type = "expected")) However, the outputs of predict function are all not in 0-1 range.

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

心不动则不痛 提交于 2019-12-05 10:21:13
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"), data=sme) summary(reg) hr <- predict(reg, type="risk") How can I add a 5th column of "Hazard Ratio"

R coxph() warning: Loglik converged before variable

百般思念 提交于 2019-12-04 20:33:28
问题 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 warning message. Why does the cofidence intervals are from 0 to Inf and the p-values so high? Here's the code and the output: > my_coxph <- coxph(Surv(tempo,status) ~ factor(Sexo)+ factor(Causa.provavel) , data=ceabn) Warning message: In fitter(X,

Plotting estimated HR from coxph object with time-dependent coefficient and splines

百般思念 提交于 2019-12-04 06:10:15
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 comes straight from ?coxph : # Fit a time transform model using current age cox = coxph(Surv(time, status) ~ ph.ecog + tt(age), data=lung, tt=function(x,t,...) pspline(x + t/365.25)) Calling survfit(cox) results in an error that survfit does not understand models with a tt term ( as described in 2011 by Terry Therneau ). You can extract the linear

Cox regression output in xtable - choosing rows/columns and adding a confidence interval

。_饼干妹妹 提交于 2019-12-03 14:20:00
问题 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) + log(protime) + log(albumin), data=pbc) summary(fit.pbc) library(xtable) xtable(fit.pbc) Now I want to do the following to the output: Add confidence interval (CI) of 95 % Select certain rows, say age and log(protime) Round the exp(B) & CI to three

R coxph() warning: Loglik converged before variable

ぐ巨炮叔叔 提交于 2019-12-03 12:20:08
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 warning message. Why does the cofidence intervals are from 0 to Inf and the p-values so high? Here's the code and the output: > my_coxph <- coxph(Surv(tempo,status) ~ factor(Sexo)+ factor(Causa.provavel) , data=ceabn) Warning message: In fitter(X, Y, strats, offset, init, control, weights = weights, : Loglik converged before variable 2,3,5,6 ; beta

How to plot a Cox hazard model with splines

好久不见. 提交于 2019-12-03 03:45: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 aiming for is something similar to this: This is when you get when you run the first example in ?cph of the

Coxph predictions don't match the coefficients

社会主义新天地 提交于 2019-12-02 08:03:34
问题 Good afternoon, I could post reproducible code and certainly will if everyone agrees that something is wrong, but right now I think my question is quite simple and someone will point me the right path. I am working in a data set like this: created_as_free_user t c <fctr> <int> <int> 1 true 36 0 2 true 36 0 3 true 0 1 4 true 28 0 5 true 9 0 6 true 0 1 7 true 13 0 8 true 19 0 9 true 9 0 10 true 16 0 I fitted a Cox Regression model like this: fit_train = coxph(Surv(time = t,event = c) ~ created

Coxph predictions don't match the coefficients

早过忘川 提交于 2019-12-02 04:04:12
Good afternoon, I could post reproducible code and certainly will if everyone agrees that something is wrong, but right now I think my question is quite simple and someone will point me the right path. I am working in a data set like this: created_as_free_user t c <fctr> <int> <int> 1 true 36 0 2 true 36 0 3 true 0 1 4 true 28 0 5 true 9 0 6 true 0 1 7 true 13 0 8 true 19 0 9 true 9 0 10 true 16 0 I fitted a Cox Regression model like this: fit_train = coxph(Surv(time = t,event = c) ~ created_as_free_user ,data = teste) summary(fit_train) And received: Call: coxph(formula = Surv(time = t, event