Hi,

I need a help in a survival analysis using survreg function with weibull 
distribution from survival package.

Look the data sample:

########## Start of script

dados <- structure(list(TFD = c(20L, 34L, 1L, 2L, 3L, 3L, 50L, 26L, 1L,
50L, 21L, 3L, 13L, 11L, 22L, 50L, 50L, 1L, 50L, 9L, 50L, 1L,
13L, 50L, 50L, 1L, 6L, 50L, 50L, 50L, 36L, 3L, 46L, 10L, 50L,
1L, 18L, 3L, 36L, 37L, 50L, 7L, 1L, 1L, 7L, 24L, 4L, 50L, 12L,
17L), Censor = c(1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1,
1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1)), .Names = c("TFD",
"Censor"), class = "data.frame", row.names = c(NA, -50L))

summary(dados)
       TFD            Censor
  Min.   : 1.00   Min.   :0.00
  1st Qu.: 3.00   1st Qu.:0.00
  Median :17.50   Median :1.00
  Mean   :23.08   Mean   :0.72
  3rd Qu.:50.00   3rd Qu.:1.00
  Max.   :50.00   Max.   :1.00

### TFD is the time for death

attach(dados)

m <- survreg(Surv(TFD,Censor)~1)

summary(m)

#Call:
#survreg(formula = Surv(TFD, Censor) ~ 1)
#            Value Std. Error     z        p
#(Intercept) 3.466      0.250 13.87 9.67e-44
#Log(scale)  0.403      0.144  2.81 4.98e-03
#
#Scale= 1.5
#
#Weibull distribution
#Loglik(model)= -156.2   Loglik(intercept only)= -156.2
#Number of Newton-Raphson Iterations: 5
#n= 50

### Calculating the mean time for death, the time that 50% of population 
is dead.
mu <- exp(3.466)
mu
#[1] 32.00845

### In this example the mean time for death (\mu) is 32.00845.

### Now the alpha calculation based on scale parameter
alpha <- 1/1.5
alpha
#[1] 0.6666667

### Making the curve
curve(exp((-mu^(-alpha))*(x^alpha)),from=0,to=50,ylim=c(0,1),col=1,ylab="Survival",xlab="Time")

### Adding lines in graphic to show the point corresponding to the 
coordinates, y=0.5 (50% of mortality) and x=32 that is the time to death 
for 50% of population.
abline(h=0.5,lty=2)
abline(v=mu,lty=2)
points(mu,0.5,cex=2)

The problem is, I expected that the estimated curve from weibull cross 
this point(32,0.5) but it is not really.

What is the problem with this analysis?

Thanks
Ronaldo

-- 
1ª lei - Suas férias começam após a defesa e entrega de sua dissertação.

       --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228.

>  Prof. Ronaldo Reis Júnior
|  .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional
| : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
| `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
|   `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br
| http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to