survival-analysis

Finding the mean of the log-normal distribution in survival analysis in R

不问归期 提交于 2019-12-11 03:24:49
问题 I am a novice with R. Currently I am fitting a log-normal distribution to some survival data I have, however I have become stuck when trying to calculate statistics such as the median and the mean. This is the code I have used so far, can anyone tell me what I should type next to find the mean? # rm(list=ls(all=TRUE)) library(survival) data<-read.table("M:\\w2k\\Diss\\Hoyle And Henley True IPD with number at risk known.txt",header=T) attach(data) data times_start <-c( rep(start_time_censor, n

neuralnet prediction returns the same values for all predictions

这一生的挚爱 提交于 2019-12-09 03:11:09
问题 I'm trying to build a neural net with the neuralnet package and I'm having some trouble with it. I've been successful with the nnet package but no luck with the neuralnet one. I have read the whole documentation package and can't find the solution, or maybe I'm not able to spot it. The training command I'm using is nn<-neuralnet(V15 ~ V1 + V2 + V3 + V4 + V5 + V6 + V7 + V8 + V9 + V10 + V11 + V12 + V13 + V14,data=test.matrix,lifesign="full",lifesign.step=100,hidden=8) and for prediction result<

Obtaining Survival Estimates in R

你。 提交于 2019-12-08 07:04:43
问题 I am trying to obtain survival estimates for different people at a specific time. My code is as follows: s = Surv(outcome.[,1], outcome.[,2]) survplot= (survfit(s ~ person.list[,1])) plot(survplot, mark.time=FALSE) summary(survplot[1], times=4)[1] This code creates the survival object, creates a survival curve for each 11 of the people, plots each of the curves, and with the summary function I can obtain the survival estimate for person 1 at time = 4 . I am trying to create a list of the

R: Proportional Hazard Assumption in coxme()

走远了吗. 提交于 2019-12-08 01:59:52
问题 I am running a mixed effects model using the coxme() function in R. The model analyzes the event of product success of firms in different countries. Fixed effects are for example GDP, population, technology and cultural variables. Random effects are the different countries. I know that with coxph() it is possible to test for proportional hazard using the cox.zph() command. My question: How can I check for proportional hazard with coxme() ? 来源: https://stackoverflow.com/questions/32401706/r

R - model.frame() and non-standard evaluation

穿精又带淫゛_ 提交于 2019-12-07 07:43:34
问题 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 "bladder", "bladder1" and "bladder2" mod_init <- coxph(Surv(start, stop, event) ~ rx + number, data = bladder2, method = "breslow") survfit(mod_init) Will yield an object that I am interested in. However, when I write it in a function, my_function

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

亡梦爱人 提交于 2019-12-07 04:53:00
问题 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")

swimmer survival plot

寵の児 提交于 2019-12-06 00:06:35
问题 Is there an easy way to generate a swimmer plot in R? Same data as in a KM curve but with each individual survival represented as a line. Example: I've searched stackoverflow, the R-help mailing list, and consulted Dr. Google without an obvious answer, though my search technique may be suboptimal. Thank you! **** ADDENDED **** Apologies for not appropriately asking a question - this is my first time! Playing around, I've been able to do the following: OS DeathYN TreatmentGroup 4 444 days 1 0

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"

Left censoring for survival data in R

一个人想着一个人 提交于 2019-12-05 02:22:55
问题 I want to perform survival analysis (Kaplan-Meier and Cox PH modelling) on data which is both left and right censored. I'm looking at the time to occurrence of a heart arrhythmia (AF) in the presence versus the absence of a particular gene (Gene 0 or 1). However, some subjects are found to already have the arrhythmia at recruitment and so should be left censored. I've read the survival package documentation but can't work out how to account for the left censoring. Some made up example data