[R-sig-ME] Testing out glmmADMB

Ben Bolker bbolker at gmail.com
Fri Jun 1 14:18:35 CEST 2012


  [cc'd to r-sig-mixed-models; I'm taking the liberty of cc'ing this so
that the discussion can be browsed by others]

On 12-05-30 06:45 PM, Mueller,John Martin wrote:
> 
> I am working on building my 3-level model in glmmADMB.  I have been
> able to get some simple 2-level models to run. However, on some of
> the simple 2-level models I get the following error message:
> 
> "The function maximize failed (couldn't find STD file)"
> 
> Does this mean the program hit the maximum iterations?  Or does it
> mean something else (e.g. I setup the model incorrectly)?

   It means there was *some* kind of problem, ranging from hitting
maximum iterations to a non-positive-definite variance-covariance matrix
for the estimated parameters.  You can try setting verbose=TRUE and
looking near the bottom of the voluminous output to see if you can get
something more useful out of it. glmmADMB could use a lot of improvement
in the way it reports problems (as could the underlying AD Model Builder
code).  The thing you have to keep in mind when fitting complex models
is that there are a lot of things that can go wrong (probably you
already know that ...)
> 
> And then on another model I get the following error message:
> 
> "Convergence failed:log-likelihood of gradient=-477.479"
> 
> I am assuming this message means that the model could not converge.
> Any suggestions on what I should look at to get the model to
> converge?

  The first place to look is ?admbControl , but that only you gives a
couple of options for tweaking.  The next thing I would try to do is to
create plots of your data that are as subdivided as possible (I use
ggplot a lot for this) and try to identify whether there are odd data
points, or odd groups, that could be messing things up.  Depending on
how much time and effort you have available, I would also considering
simulating models with similar structure to your data and see whether
you can fit them successfully (and get reasonable answers); if not (i.e.
if it fails when the data is *known* to be structured in exactly the
same way as the model assumes), then your model is probably just too
complicated to handle.

  Another option is trying better starting values, and in particular
getting reasonable starting values by building up from a simpler model.
 The usual tricks of centering and scaling continuous predictors, and
orthogonalizing or otherwise dealing with strongly correlated
predictors, are also useful (although if you're only dealing with a
single continuous predictor ranging from 0 to 5 that may not matter that
much).

> 
> And then I am looking into the format that needs to be used to run
> the 3-level model in glmmADMB.  A simple 3-level growth curve model
> would be the following in my case:
> 
> NTCS ~ 1 + TIME + (TIME | ID | LOCATION)
> 
> where,
> 
> NTCS = number of total credit sources (the variable is count data and
> has an overdispersion of zeros)
> 
> TIME = the time period, 0-5
> 
> ID = the firm ID
> 
> LOCATION = the location of the firm (metro statistical area)
> 
> ID and LOCATION have been converted into a factor, per the error
> message I received when I didn't convert the ID variable to a factor
> (message: all grouping variables in random effects must be factors).
> 
> Is this the correct formatting for the 3-level model?

  I assume you are trying to fit a (log-)linear model to TIME.  I think
that something like ~ TIME + (TIME|LOCATION/ID) would be what you
wanted; this would fit an overall slope (and intercept: the "1+" in the
fixed-effect part of the formula is optional/implicit); variation in the
slope with respect to time across locations; and variation in the slope
with respect to time across firms within location.
> 
> Note: I would normally send you the script and the data, as that
> would help with the explanation.  However, I am having to work on a
> secure server for this analysis as the data is confidential (on a
> NORC.org server).
> 
> Thx.
> 
> - JM
>



More information about the R-sig-mixed-models mailing list