Forum: help
Monitor Forum | Start New ThreadNewton-Raphson maximisation - Initial value out of range [ Reply ] By: Rachel Yeoh on 2022-01-25 13:29 | [forum:49275] echocardiogram.txt (6) downloads |
Hi anyone can help with the code below. I cannot obtain the MLE estimate as it always shows the error "Initial value out of range". data<- read.table("C:/Users/USER/Desktop/echocardiogram.txt", header=TRUE) library(maxLik) LLF <- function(para) { t<-data$MONTHS s_i<-data$CENSOR x<-data$AGE b0<-para[1] b1<-para[2] beta <- para[3] z<-exp(-b0-b1*x) m<-z*(1-exp(t^beta)) e<-s_i*(log(z*beta*t^(beta-1))+(t^beta)+m)+(1-s_i)*z f<- sum(e) return(f) } mle<- maxLik(LLF, start=c(b0=0.04,b1=0.2,beta=0.5)) summary(mle) b0hat <- mle$estimate[1] b1hat<- mle$estimate[2] betahat <- mle$estimate[3] I've attached the data to run. |