survival-analysis

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,

How do I extract hazards from survfit in R?

时光总嘲笑我的痴心妄想 提交于 2019-12-04 04:07:47
I have a survfit object. A summary survfit for my t=0:50 years of interest is easy enough. summary(survfit, t=0:50) It gives the survival at each t. Is there a way to get the hazard for each t (in this case, the hazard from t-1 to t in each t=0:50)? I want to get the mean and confidence interval (or standard error) for the hazards relating to the Kaplan Meier curve. This seems easy to do when a distribution is fit (eg. type="hazard" in flexsurvreg ) but I can't figure out how to do this for a regular survfit object. Suggestions? It is a bit tricky since the hazard is an estimate of an

How to predict survival probabilities in R?

旧城冷巷雨未停 提交于 2019-12-03 21:32:04
问题 I have data called veteran stored in R. I created a survival model and now wish to predict survival probability predictions. For example, what is the probability that a patient with 80 karno value, 10 diagtime , age 65 and prior=10 and trt = 2 lives longer than 100 days? In this case the design matrix is x = (1,0,1,0,80,10,65,10,2) Here is my code: library(survival) attach(veteran) weibull <- survreg(Surv(time,status)~celltype + karno+diagtime+age+prior+trt ,dist="w") and here is the output:

Survival analysis in PyMC 3

妖精的绣舞 提交于 2019-12-03 20:10:45
问题 I tried to port simple survival model from here (the first one in introduction) form PyMC 2 to PyMC 3. However, I didn't find any equivalent to "observed" decorator and my attempt to write a new distribution failed. Could someone provide an example how is this done in PyMC 3? 回答1: This is a tricky port, and requires three new concepts: Use of the theano tensor Use of the DensityDist Passing a dict as observed This code provides the equivalent model as the PyMC2 version you linked to above:

Confidence intervals of the muhaz package hazard function

房东的猫 提交于 2019-12-03 17:37:09
问题 The muhaz package estimates the hazard function from right censored data using kernel smoothing methods. My question is, is there any way to obtain confidence intervals for the hazard function that muhaz calculates? options(scipen=999) library(muhaz) data(ovarian, package="survival") attach(ovarian) fit1 <- muhaz(futime, fustat) plot(fit1, lwd=3, ylim=c(0,0.002)) In the above example the muhaz.object fit has some entries fit1$msemin , fit1$var.min , fit1$haz.est however their length is half

Plot survival and hazard function of survreg using curve()

江枫思渺然 提交于 2019-12-03 13:18:53
问题 I have the following survreg model: Call: survreg(formula = Surv(time = (ev.time), event = ev) ~ age, data = my.data, dist = "weib") Value Std. Error z p (Intercept) 4.0961 0.5566 7.36 1.86e-13 age 0.0388 0.0133 2.91 3.60e-03 Log(scale) 0.1421 0.1208 1.18 2.39e-01 Scale= 1.15 Weibull distribution I would like to plot the hazard function and the survival function based on the above estimates. I don't want to use predict() or pweibull() (as presented here Parametric Survival or here SO question

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

Using a survival tree from the 'rpart' package in R to predict new observations

时光总嘲笑我的痴心妄想 提交于 2019-12-03 10:09:06
问题 I'm attempting to use the "rpart" package in R to build a survival tree, and I'm hoping to use this tree to then make predictions for other observations. I know there have been a lot of SO questions involving rpart and prediction; however, I have not been able to find any that address a problem that (I think) is specific to using rpart with a "Surv" object. My particular problem involves interpreting the results of the "predict" function. An example is helpful: library(rpart) library(OIsurv)

Confidence intervals of the muhaz package hazard function

拜拜、爱过 提交于 2019-12-03 06:33:23
The muhaz package estimates the hazard function from right censored data using kernel smoothing methods. My question is, is there any way to obtain confidence intervals for the hazard function that muhaz calculates? options(scipen=999) library(muhaz) data(ovarian, package="survival") attach(ovarian) fit1 <- muhaz(futime, fustat) plot(fit1, lwd=3, ylim=c(0,0.002)) In the above example the muhaz.object fit has some entries fit1$msemin , fit1$var.min , fit1$haz.est however their length is half of the fit1$haz.est . Any ideas if it is possible to extract confidence intervals for the hazard

Plot survival and hazard function of survreg using curve()

随声附和 提交于 2019-12-03 03:27:35
I have the following survreg model: Call: survreg(formula = Surv(time = (ev.time), event = ev) ~ age, data = my.data, dist = "weib") Value Std. Error z p (Intercept) 4.0961 0.5566 7.36 1.86e-13 age 0.0388 0.0133 2.91 3.60e-03 Log(scale) 0.1421 0.1208 1.18 2.39e-01 Scale= 1.15 Weibull distribution I would like to plot the hazard function and the survival function based on the above estimates. I don't want to use predict() or pweibull() (as presented here Parametric Survival or here SO question . I would like to use the curve() function. Any ideas how I can accomplish this? It seems the Weibull