[R] non-finite finite-difference value[]

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 25 08:31:25 CET 2006

On Tue, 24 Jan 2006, P. Olsson wrote:

> Dear R-helpers,
> running a zeroinflated model of the following type:
> zinb = zeroinfl(count=response ~., x = ~ . - response, z = ~. - response,
> dist = "negbin", data = t.data, trace = TRUE)
> generates the following message:
> Zero-Inflated Count Model
> Using logit to model zero vs non-zero
> Using Negative Binomial for counts
> dependent variable y:
> Y
>  0   1   2   3
> 359  52   7   3
> generating start values...done
> MLE begins...
> initial  value 262.883959
> error in optim(fn = llhfunc, par = stval, method = method, control =
> control,  :
>        non-finite finite-difference value [3]
> Short version of my question:
> what information does non-finite finite-difference value [3] give?
> Extended version of my question:
> Since zeroinfl() calls optim(), I assume, that an infinite value is
> generated during the iteration steps of the optimizing algorithm. So the
> value[3] gives me a hint to the step, when it happens?

No.  The gradient is a vector, which is (I assume from the optim call) 
being evaluated by finite differences.  It is the third element of the 
vector that is non-finite (infinite or NA or NaN).

The information is for the optim user, which in this case is zeroinfl,
and is probably best passed on to the author of that function with an 

> Or expressed in a different way, are my data structured in a way, that
> finding the maximum in the response surface is highly sensitive of the
> initial value, used for the algorithm?
> And if this is correct, is there an easy way in R, to set another starting
> value that the one, which is generated automatically in zeroinfl() (I mean,
> just from the technical point of view, without considering the theoretical
> thrill, which will be my next problem, since it is not at all familiar to
> me.).
> Or last questions: how can I extract the function, generated by zeroinfl()
> and passed to optim()? Is there a possibility to visualize it, so that I get
> an idea, what is going on?

These are questions about zeroinfl.  That is not part of R, and we don't 
know what it is.  There is a function of that name in package pscl, 
but you have not mentioned that and there could be others.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
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

More information about the R-help mailing list