[R] MLE, precision
zboshao at yahoo.com
Tue Jul 13 16:25:35 CEST 2004
I am trying to estimate 3 parameters for my survival
function. It's very complicated. The negative
loglikelihood function is:
l<- function(m1,m2,b) -sum( d*( log(m1) + log(m2)
+ log(1- exp(-(b + m2)*t)) ) + (m1/b - d)*log(m2 +
b*exp(-(b + m2)*t) ) + m1*t - m1/b*log(b+m2) )
here d and t are given, "sum" means sum over these
the parameters are assumed small, m1, m2 in
thousandth, m2 in millionth.
I used the function "nlm" to estimate m1,m2,b. But the
result is very bad. you can get more than 50 warnings,
most of them are about "negative infinity"in log. And
the results are initial value dependent, or you will
get nothing when you choose some values.
So I tried brutal force, i.e. evaluate the values of
grid point. It works well. Also, you can get the
correct answer of log(1e-12).
My questions are:
What is the precision of a variable in R?
How to specify the constraint interval of parameters
in nlm? I tried lower, upper, it doesn't work.
any advice on MLE is appreciated.
More information about the R-help