Finding the mean of the log-normal distribution in survival analysis in R
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_censors), rep(start_time_event, n_events) )
times_end <-c( rep(end_time_censor, n_censors), rep(end_time_event,
n_events) ) model <- survreg(Surv(times_start, times_end,
type="interval2")~1, dist="lognormal") intercept <-
summary(model)$table[1]
log_scale <- summary(model)$table[2]
this is where I got stuck, I have tried:
meantime<-exp(intercept+log_scale/2)
but this does not seem to give a realistic mean
Thanks for any help!
No comments:
Post a Comment