Displaying 1 result from an estimated 1 matches for "timeto".
Did you mean:
timeo
2007 Jun 28
0
WEIBULL FRAILTY MODEL HELP
...s from Keiding and Klein artricle published in
the Statistics in Medicine 1996) .
While the simple weibull model runs perfectly ( I get -2*loglikelihood 1093,905), the
weibull frailty model does not run well.
The code I write is :
likelihood.weibul <- function(p) {
cumhaz <- exp(x1*p[4])*(timeto^p[2])/p[1]
cumhaz <- sum(cumhaz)
lnhaz <- (x1*p[4]+log((p[2]*timeto^(p[2]-1))/p[1]))*stat
lik <- p[3]*log(p[3])-log(gamma(p[3]))+sum(lnhaz)+
log(gamma(di+p[3]))-(p[3]+di)*log(p[3]+cumhaz)
-2*lik
}
di <-sum(stat)
initial<-c(500000,2.8,.5,1.8)
# initial 1/exp(constant)
t<-nlm(likeli...