<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri, sans-serif" size="4">
<div>Hello list,</div>
<div> </div>
<div>We are trying to compare a number of glmm.admb models with different fixed effects. For convenience, we want to automate this and exclude unreasonable combinations afterward. We are losing control from an R function that calls glmm.admb after it fails
with the message, ‘Hessian that does not appear to be positive definite’ (see below for partial output, B). </div>
<div><font face="Calibri, sans-serif" size="2"> </font></div>
<div>Putting the call in a try loop (below A) did not work -- apparently control did not return to the function, but my understanding of how R try loops work is weak. For the time being, we’re just looking for a graceful exit (control returned to function,
ideally with a null model object returned), not necessarily a solution to the convergence problem, although we’ll take any help we can get. For what its worth, this could be a model with high collinearity, but if we run it alone after it fails in the function
call, we do get a solution, however unstable (below C).</div>
<div> </div>
<div>If there’s any other information i should have provided to help with solving this, please let me know and i’ll try again. Thanks very much for any assistance. I appreciate your time and experience.</div>
<div><font face="Calibri, sans-serif" size="2"> </font></div>
<div>Yetta</div>
<div><font face="Calibri, sans-serif" size="2"> </font></div>
<ol type="A" style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 36pt; ">
<font color="#17365D">
<li>My code snippet from within a function:</li></font>
</ol>
<div><font face="Courier New, monospace" size="2"># Run admb in try block</font></div>
<div><font face="Courier New, monospace" size="2"> try</font></div>
<div><font face="Courier New, monospace" size="2"> {</font></div>
<div><font face="Courier New, monospace" size="2"> options(show.error.messages = TRUE);</font></div>
<div><font face="Courier New, monospace" size="2"># M[[my_id]] <- lm( new_fixed, data = Data);</font></div>
<div><font face="Courier New, monospace" size="2"> M[[my_id]] <- glmm.admb( fixed = new_fixed, random = ~1, group = "Subregion", data = Data, </font></div>
<div><font face="Courier New, monospace" size="2"> family = "nbinom", verbose = TRUE);</font></div>
<div><font face="Courier New, monospace" size="2"> }</font></div>
<div><font face="Courier New, monospace" size="2"> if (is.null(M[[my_id]]))</font></div>
<div><font face="Courier New, monospace" size="2"> {</font></div>
<div><font face="Courier New, monospace" size="2"> warnings();</font></div>
<div><font face="Courier New, monospace" size="2"> print(paste("Model failed for variables ", new_fixed, sep=""));</font></div>
<div><font face="Courier New, monospace" size="2"> }</font></div>
<div><font face="Courier New, monospace" size="2"> else</font></div>
<div><font face="Courier New, monospace" size="2"> {</font></div>
<div><font face="Courier New, monospace" size="2"> print(M[[my_id]]);</font></div>
<div><font face="Courier New, monospace" size="2"> }</font></div>
<div><font face="Calibri, sans-serif" size="2"> </font></div>
<div><font color="#17365D">B) Excerpt of error from R Console:</font></div>
<div><font color="#943634">- final statistics:</font></div>
<div><font color="#943634">10 variables; iteration 8; function evaluation 15</font></div>
<div><font color="#943634">Function value 7.3589e+002; maximum gradient component mag -7.5466e-005</font></div>
<div><font color="#943634">Exit code = 1; converg criter 1.0000e-004</font></div>
<div><font color="#943634">Var Value Gradient |Var Value Gradient |Var Value Gradient </font></div>
<div><font color="#943634"> 1 46.2451 -2.6335e-005 | 2 3.7589 -4.2522e-005 | 3 -3.2869 1.5670e-005</font></div>
<div><font color="#943634"> 4 -2.4314 -2.1427e-005 | 5 -0.1699 9.2829e-006 | 6 1.1824 9.5950e-006</font></div>
<div><font color="#943634"> 7 2.5560 1.2540e-005 | 8 4.9276 -1.0343e-005 | 9 -0.9850 -7.5466e-005</font></div>
<div><font color="#943634"> 10 0.0909 -7.3008e-006 |</font></div>
<div><font color="#943634"> inner maxg = 7.625473665e-018 Inner f = 742.3228266</font></div>
<div><font color="#943634"> f = 742.3228266 max g = 7.625473665e-018</font></div>
<div><font color="#943634">.</font></div>
<div><font color="#943634">.</font></div>
<div><font color="#943634">.</font></div>
<div><font color="#943634">Newton raphson 1 f = 742.3228521 max g = 8.934094073e-018</font></div>
<div><font color="#943634"> inner maxg = 1.48457798e-008 Inner f = 742.3229286</font></div>
<div><font color="#943634"> f = 742.3229286 max g = 1.48457798e-008</font></div>
<div><font color="#943634">Newton raphson 1 f = 742.3229286 max g = 1.422953313e-017</font></div>
<div><font color="#943634">Warning -- Hessian does not appear to be positive definite</font></div>
<div><font color="#943634">Error in glmm.admb(fixed = new_fixed, random = ~1, group = "Subregion", : </font></div>
<div><font color="#943634"> The function maximizer failed</font></div>
<div><font face="Calibri, sans-serif" size="2"> </font></div>
<div>C)</div>
<div>.</div>
<div>.</div>
<div>.</div>
<div>Newton raphson 1 f = 740.6118656 max g = 6.495461568e-017</div>
<div> inner maxg = -1.83792469e-007 Inner f = 740.6119407</div>
<div> f = 740.6119407 max g = 1.83792469e-007</div>
<div>Newton raphson 1 f = 740.6119407 max g = 6.888384188e-017</div>
<div>Warning message:</div>
<div>In model.matrix.default(fixed, data) :</div>
<div> variable 'Subregion' converted to a factor</div>
<div>> print(M[[my_id]])</div>
<div> </div>
<div>GLMM's in R powered by AD Model Builder:</div>
<div> </div>
<div> Family: nbinom </div>
<div> alpha = 3.7056 </div>
<div> </div>
<div>Fixed effects:</div>
<div> Log-likelihood: -734.179 </div>
<div> Formula: N_Species ~ TPmgL + SedgL + HUC8_ups + Subregion </div>
<div> (Intercept) TPmgL SedgL </div>
<div> 3.0629000 -0.3526400 -0.0072777 </div>
<div> HUC8_ups SubregionCanadian SubregionCimarron </div>
<div> 0.0150080 -0.2057500 -0.1883800 </div>
<div> SubregionD_Red SubregionL_Arkansas SubregionNeosho-Verdigris </div>
<div> 0.5095900 0.8566100 1.1929000 </div>
<div> SubregionU_White </div>
<div> 1.4180000 </div>
<div> </div>
<div>Random effects:</div>
<div> Grouping factor: Subregion </div>
<div> Formula: ~1 </div>
<div>Structure: Diagonal matrix</div>
<div> (Intercept) </div>
<div>0.0005155773 </div>
<div> </div>
<div>Number of Observations: 173 </div>
<div>Number of Groups: 7</div>
<div><font face="Calibri, sans-serif" size="2"> </font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"><i>Yetta Jager </i></font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"><i>Environmental Sciences Division </i></font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"><i>Oak Ridge National Laboratory </i></font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"><i>P.O. Box 2008, MS 6036 </i></font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"><i>Oak Ridge, TN 37831-6036 USA</i></font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"> </font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"><i>For packages, please replace "P.O. Box 2008" with "Bethel Valley Road".</i></font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"> </font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"><i>OFFICE: 865/574-8143 FAX: 865/576-3989 </i></font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"><i>Work email: jagerhi@ornl.gov Home email: jagerhi@chartertn.net</i></font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"><i>My webpage: <a href="http://www.esd.ornl.gov/~zij/">
http://www.esd.ornl.gov/~zij/</a></i></font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"><i>Fish and Wildlife Modelling:
<a href="http://www.esd.ornl.gov/research/ecol_management/fish_wildlife_modeling">
http://www.esd.ornl.gov/research/ecol_management/fish_wildlife_modeling</a></i></font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"> </font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"> </font></div>
<div><font face="Lucida Sans Unicode, sans-serif" size="2"> </font></div>
<div><font face="Calibri, sans-serif" size="2"> </font></div>
<div><font face="Calibri, sans-serif" size="2"> </font></div>
</font>
</body>
</html>