[R] probit analysis with natural response

Jinsong Zhao jszhao at mail.hzau.edu.cn
Fri Jun 20 07:59:22 CEST 2008


Dear all,

I have try to use mle() from package stats4 to estimate parameters of
the following model:

p = Pr(Y = 0) = C + (1 - C)F(x'\beta)

a probit model with natural response.

The log-likelihood function is:

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)))
}

When give the following dataset:

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)

And then,

fit <- mle((fr), start = list(c =0.2, alpha = 0, beta =0), method = "BFGS")

It will give the following error message:

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

However, when I set beta to 0.1, mle() could terminate normally. Set
beta to 0.001 or 5, for example, the above command will give the
following error message:

Error in optim(start, f, method = method, hessian = TRUE, ...) :
  non-finite finite-difference value [3]
                                     ~~~or [1] when beta set to 5.

What's wrong? And how to improve the above code?

Thanks in advance!

Jinsong Zhao



More information about the R-help mailing list