[R] Survival curve mean adjusted for covariate: NEED TO DO IN NEXT 2 HOURS, PLEASE HELP
mark.fisher123
marko.fisher2008 at gmail.com
Tue Sep 21 14:09:50 CEST 2010
Hi
I am trying to determine the mean of a Weibull function that has been fit to
a data set, adjusted for a categorical covariate , gender (0=male,1=female).
Here is my code:
library(survival)
survdata<-read.csv("data.csv")
##Fit Weibull model to data
WeiModel<-survreg(Surv(survdata$Time,survdata$Status)~survdata$gender)
summary(WeiModel)
P<-pweibull(n, scale=exp(WeiModel$coef[1]), shape=1/WeiModel$scale)
##Return mean
scale<-exp(WeiModel$coef[1])
shape<-1/WeiModel$scale
mean <- scale*gamma(1+1/shape)
mean
The problem is that the mean is based on the baseline coefficient which
assumes the population is male (= 0). I want an adjusted mean which isnt
assuming the whole population is male, or female - so the baseline
coefficient is completely adjusted for gender.
Help ASAP would be much appreciated!
Thanks!
Mark
--
View this message in context: http://r.789695.n4.nabble.com/Survival-curve-mean-adjusted-for-covariate-NEED-TO-DO-IN-NEXT-2-HOURS-PLEASE-HELP-tp2548484p2548484.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list