Displaying 2 results from an estimated 2 matches for "weimodel".
Did you mean:
memmodel
2010 Sep 21
2
Survival curve mean adjusted for covariate: NEED TO DO IN NEXT 2 HOURS, PLEASE HELP
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...
2010 May 26
2
Survival analysis extrapolation
...0
Treatment A 84 0
Treatment A 84 0
etc etc
Where time is in days and goes up to 360, 0 represents a withdrawal and 1
represents a failure. The code I've tried is as follows:
survdata<-read.csv("Data.csv")
WeiModel<-survreg(Surv(survdata$Time,survdata$Status)~survdata$Treatment)
summary(WeiModel)
n<-seq(0, 1080, 30 )
##Compute Weibull CDF
A<-pweibull(n, scale=exp(WeiModel$coef[1]), shape=1/WeiModel$scale)
B<-pweibull(n,
scale=exp(WeiModel$coef[1]+WeiModel$coef[2]),shape=1/WeiModel$scale)
##...