Why are you doing this instead of using the survival package?

Bert

On Tuesday, April 28, 2015, Hanze Zhang <[email protected]> wrote:

> Hi, R users,
>
>
> I am using nlm function to get the MLE of parameter alpha and lambda from a
>  parametric survival model (Weibull distribution). However, this message
> always came out: ' invalid function value in 'nlm' optimizer'. Could anyone
> help me? Code is
>
> project<-read.table(file="C://data.txt", header=T, as.is=T)
> names(project)
> attach(project)
>
> x<-time
> delta<-ind
>
>
> # -log likelihood
> #alpha<-theta[1]
> #lambda<-theta[2]
> ln<-function(theta)
>   {
>
>
>  
> -sum(delta)*log(theta[1]*theta[2])-sum(delta)*(theta[1]-1)*log(x[delta==1])+theta[2]*sum(x^theta[1])
> }
>
> #MLE
> nlm(ln,theta<-c(1,1),hessian=TRUE)
>
>
> Thanks!
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [email protected] <javascript:;> mailing list -- To UNSUBSCRIBE and
> more, see
> 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.
>


-- 

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom."
Clifford Stoll

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
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