On Tue, 24 Jun 2008, Jinsong Zhao wrote:

Another question related with the same code:

r <- c(3,4,4,3,5,4,5,9,8,11,12,13)
n <- rep(15,12)
x <- c(0, 1.1, 1.3, 2.0, 2.2, 2.8, 3.7, 3.9, 4.4, 4.8, 5.9, 6.8)
x <- log10(x)
fr <- function(c, alpha, beta) {
  P <- c + (1-c) * pnorm(alpha + beta * x)
  P <- pmax(pmin(P,1),0)
  -(sum(log(choose(n,r))) + sum(r * log(P)) + sum((n -r)* log(1-P)))
 }
fit <- mle((fr), start = list(c =0.2, alpha = 0, beta =0.1), method =
"BFGS")


0 * (-Inf) = NaN.
pnorm(0 + 0*log10(0)) = NaN

See my previous answer.


The above code could terminate normally. However, if ``beta'' set to 0, then the following error message will appear:

Error in optim(start, f, method = method, hessian = TRUE, ...) :
 initial value in 'vmmin' is not finite

I have learn that "drc" package could deal with this situation, it set the first observation to control, however, I don't find the way to implement it in the source code, for the code is too complex to me.

Any suggestion? Thanks in advance!

You could always try out your own code piece by piece.

Jinsong

______________________________________________
R-help@r-project.org mailing list
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.


--
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@r-project.org mailing list
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