Hi Helen,
This could be an indication that the negative binomial you are trying to fit is
not a good model for the process that generated the data. glm.nb uses an
alternating estimation process, alternately fixing mu and estimating theta,
then fixing theta and estimating mu. There is an iteration limit on both
cycles and occasionally it happens that early on in the process, when mu is not
very good, the estimation for theta runs to the limit, but the next time round
when mu is closer to the MLE, it can be OK. I suspect the problem is that the
NB model is not a good one, though.
You can check this to some extent by supplying an initial value for theta using
init.theta = <value>
on the call to glm.nb, choosing a value suggested by previous runs. If it is
the true mle, you should not get those warning messages.
If the estimate of theta is just getting larger and larger, then it suggests a
Poisson model may be appropriate. If it's getting smaller and smaller, I'm not
sure what's going on.
Also, I would suggest you always call glm.nb (and glm, too) setting trace =
TRUE. This gives more insight on what's going on during the iteration process.
Bill Venables
CMIS, CSIRO Laboratories,
PO Box 120, Cleveland, Qld. 4163
AUSTRALIA
Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary): +61 7 3826 7304
Mobile (rarely used): +61 4 1963 4642
Home Phone: +61 7 3286 7700
mailto:Bill.Venables@csiro.au
http://www.cmis.csiro.au/bill.venables/
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of wuy
Sent: Wednesday, 3 January 2007 1:37 PM
To: s-news@lists.biostat.wustl.edu
Subject: [S] What?s the best way to deal with ?iteration limit reached?
whenrunning glm.nb()?
Hello S+ers,
Happy New Year to everyone!
I'm a newbie in S+, please forgive me if my question appears trivial, but I do
need some help from you.
I'm trying to fit a negative binomial regression model under S-Plus 6.1 for
Windows, and the function I use is glm.nb() from MASS library for Venables &
Ripley (2002) version 7.0. First, I didn't give any control values to the
model, my model was like
> negb.test <- glm.nb (Y ~ X1 + X2 + X3 +X4 + X5 +X6, data=mydata)
Warning in theta.ml(Y, mu, n, limit = control$maxit, trace = control$trace > 2):
iteration limit reached
Warning in theta.ml(Y, mu, n, limit = control$maxit, trace = control$trace > 2):
iteration limit reached
Warning in theta.ml(Y, mu, n, limit = control$maxit, trace = control$trace > 2):
iteration limit reached
Warning in theta.ml(Y, mu, n, limit = control$maxit, trace = control$trace > 2):
iteration limit reached
Thought some control might help a bit, I re-coded it as
> negb.test2 <- glm.nb (Y ~..., init.theta=0.85, link=log, data=mydata)
The same warning message, and it repeats four times again.
I'm just wondering must I give a limit number for the iteration to reach an
"optimal" result, and what is the maximum number of iteration. Also, what
does the "trace = control$trace > 2" mean, I thought trace is a logic
value, how to interpret (and possibility fix) this problem?
Oh, the length of my data is over 30000, is it too big for S+ to handle? If so,
what can I do with it?
Many thanks in advance, and humbly awaiting illumination!
Helen Wu
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|