<div dir="ltr">Hi again both - <div><br></div><div>My main question is that the lmrob() function quits seemingly randomly sometimes, but if I just keep calling it, eventually it works fine (although yes some time series report back errors in either case). I have run it on a new computer with the most recent version of R and had the same thing happen. </div><div><br></div><div>In any case - attached is the .rds file of the database I am running for this. I have a function that runs lmrob() on time series of each species x management type x location (i.e. via the "gind" variable - or "group identifier"), which is then the subset as "DBx" from the original set "DB". The call for running lmrob() then is: </div><div><br></div><div>lm_test<-tryCatch(lmrob(log(pop_status+1)~observation_year,DBx), finlly=print(i)) <br><div><br></div><div>I use "tryCatch" to print out where I have warnings so I can go back and look at these species, to determine if we should include them or not given the warnings. </div><div><br></div><div>I did also try your suggestion, Werner, but this did not return results for a species, gind="perdix perdix_in_rec", and once that happened, the next steps in the function to gather certain aspects of the results returned an error message (as there weren't any results) and stopped the function via </div><div><br></div><div> Error in dimnames(ans$coefficients) <- list(names(est), cf.nms) : <br>  length of 'dimnames' [1] not equal to array extent <br></div><div><br></div><div>because there are no coefficients to reference, i.e. the issue is calling summary(lm_test)$coefficients. In any case, this species, gray partridge in Indiana under recreational hunt management, has only three observations over 15 years, and although they are clearly declining over that period - but it is not the only species with only 3 observations in the time series. </div><div><br></div><div>In any case, I subset out this one time series and ran it again - results are the same as without it, but it does run to the end without the error. Any ideas why this one species is knocking this out? </div><div><br></div><div>Attached is the .rds file, as well as the script I am using, and the terrestrial species .csv data file. </div><div><br></div><div>Thank you again!</div><div>Emily</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 26, 2019 at 4:40 PM Stahel  Werner A. <<a href="mailto:stahel@stat.math.ethz.ch" target="_blank">stahel@stat.math.ethz.ch</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div>


<div dir="ltr">
<div id="m_-2241886892106675348gmail-m_5575224289811117484x_divtagdefaultwrapper" dir="ltr" style="font-size:10pt;color:rgb(0,0,0);font-family:Arial,Helvetica,sans-serif">
<p>Sorry, Martin and Emily, for this stupid mistake.</p>
<p>Just to make things very concrete, you might use</p>
<p><br>
</p>
<p>lmrob( y~year, method="M", init=lmrob.lar, psi="lqq")</p>
<p><br>
</p>
<p>Please let us know if there are still warnings with this version.</p>
<p><br>
</p>
<p>Best regards. Werner<br>
</p>
<p><br>
</p>
<div id="m_-2241886892106675348gmail-m_5575224289811117484x_Signature">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px"><font size="2" face="Arial">Werner Stahel<br>
M +41 79 784 9330 | P +41 44 364 6424</font><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_-2241886892106675348gmail-m_5575224289811117484x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Martin Maechler <<a href="mailto:maechler@stat.math.ethz.ch" target="_blank">maechler@stat.math.ethz.ch</a>><br>
<b>Gesendet:</b> Montag, 26. August 2019 10:00:01<br>
<b>An:</b> Stahel Werner A.<br>
<b>Cc:</b> Emily Klein; <a href="mailto:r-sig-robust@r-project.org" target="_blank">r-sig-robust@r-project.org</a><br>
<b>Betreff:</b> Re: [RsR] error/warning messages with lmrob()</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt">
<div class="m_-2241886892106675348gmail-m_5575224289811117484PlainText">>>>>> Stahel Werner A <br>
>>>>>     on Sat, 24 Aug 2019 21:04:04 +0000 writes:<br>
<br>
    > Dear Emily<br>
<br>
    >  A short answer also to your questions about<br>
    > non-convergence of lmrob.  You are using it to<br>
    > characterize the trend in many time series.  I assume that<br>
    > the problems are caused by the series being short.  I<br>
    > would be interested in getting some of those that cause problems.<br>
<br>
Indeed, me too. (we mean getting the datasets, e.g., sending us<br>
         the file  'lmrob-problm.rds'  after<br>
   <br>
   saveRDS(<your-data-frame>, file = "lmrob-problm.rds")<br>
<br>
)<br>
<br>
    > For a simple regression, you may fall back on good old<br>
    > rlm(...)  In the meantime, I will again try to convince<br>
    > the maintainers of lmrob to introduce the possibility of<br>
    > providing initial values that allow for avoiding the<br>
    > initial S step -- since this step causes the problems.<br>
<br>
Well, 'init' has been an argument of lmrob() "forever", and has<br>
quite a nice paragraph on the help page of lmrob (search for<br>
"initial estimator") *and* another paragraph in the 'Examples'<br>
of the help page, online versions of which are nowadays easily found by googling <br>
'lmrob robustbase'), notably these two:<br>
- <a href="https://www.rdocumentation.org/packages/robustbase/versions/0.93-5/topics/lmrob" target="_blank">
https://www.rdocumentation.org/packages/robustbase/versions/0.93-5/topics/lmrob</a><br>
- <a href="https://rdrr.io/cran/robustbase/man/lmrob.html" target="_blank">https://rdrr.io/cran/robustbase/man/lmrob.html</a><br>
<br>
[I really would not go back to use rlm().]<br>
<br>
Martin<br>
<br>
<br>
    > Best regards. Werner<br>
<br>
    > Werner Stahel M +41 79 784 9330 | P +41 44 364 6424<br>
    > ________________________________<br>
    >> Von: R-SIG-Robust <<a href="mailto:r-sig-robust-bounces@r-project.org" target="_blank">r-sig-robust-bounces@r-project.org</a>> im<br>
    >> Auftrag von Emily Klein <<a href="mailto:emily.klein04@gmail.com" target="_blank">emily.klein04@gmail.com</a>><br>
    >> Gesendet: Montag, 15. Juli 2019 21:45:00 An:<br>
    >> <a href="mailto:r-sig-robust@r-project.org" target="_blank">r-sig-robust@r-project.org</a> Betreff: [RsR] error/warning<br>
    >> messages with lmrob()<br>
    >> <br>
    >> Dear all,<br>
    >> <br>
    >> I am running lmrob() under the robustbase package, and I<br>
    >> have a few error/warning messages I would greatly<br>
    >> appreciate help with - I am unfamiliar with robust linear<br>
    >> models, so my apologies in advance if the answers here<br>
    >> are obvious. In addition, any discussion will help me get<br>
    >> a handle on what we're doing, which always helps.<br>
    >> <br>
    >> (1) I get the repeated error seemingly on random species<br>
    >> when running a loop of lmrob() over all our ecological<br>
    >> time series (different ones almost every time):<br>
    >> <br>
    >> Error in eigen(ret, symmetric = TRUE) : infinite or<br>
    >> missing values in 'x'<br>
    >> <br>
    >> I have checked my data many times, and if I just<br>
    >> repeatedly run lmrob() it eventually works. Any idea what<br>
    >> this error is in reference to? Could it be because I am<br>
    >> using a previous version of R (3.4.1)?<br>
    >> <br>
    >> (2) I have several two error messages that come up with<br>
    >> some time series; I have some idea their meaning, but<br>
    >> again, as a newbie with RLMS, I am wondering if those<br>
    >> time series that garner these warnings should be excluded<br>
    >> from our meta-analysis. Also, any additional insight on<br>
    >> the process or something I might be missing greatly<br>
    >> welcomed!<br>
    >> <br>
    >> Warning in lmrob.S(x, y, control = control) :<br>
    >> find_scale() did not converge in 'maxit.scale' (= 200)<br>
    >> iterations with tol=1e-10, last rel.diff=0<br>
    >> <br>
    >> Warning in lmrob.fit(x, y, control, init = init) : M-step<br>
    >> did NOT converge. Returning unconverged SM-estimate<br>
    >> <br>
    >> Warning in lmrob.S(x, y, control = control) : S-estimated<br>
    >> scale == 0: Probably exact fit; check your data<br>
    >> <br>
    >> Thank you very much in advance,<br>
    >> <br>
    >> Emily<br>
    >> <br>
    >> <br>
    >> --<br>
    >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
    >> Emily S. Klein, Senior Postdoctoral Associate (she / her<br>
    >> / hers) The Frederick S. Pardee Center for the Study of<br>
    >> the Longer-Range Future | Boston University *Co-Chair*,<br>
    >> ICES Working Group on the History of Fish & Fisheries<br>
    >> (WGHIST) <a href="mailto:esklein04@gmail.com" target="_blank">esklein04@gmail.com</a><br>
    >> <br>
    >> <a href="http://www.bu.edu/pardee/" target="_blank">http://www.bu.edu/pardee/</a><br>
    >> <a href="http://www.ices.dk/community/groups/Pages/WGHIST.aspx" target="_blank">http://www.ices.dk/community/groups/Pages/WGHIST.aspx</a><br>
</div>
</span></font>
</div>

</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_-2241886892106675348gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><span><font color="#888888">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>Emily S. Klein, Senior Postdoctoral Associate (she / her / hers)<br>The Frederick S. Pardee Center for the Study of the Longer-Range Future | Boston University</font></span></div><div dir="ltr"><font color="#888888"><i>Co-Chair</i>, ICES Working Group on the History of Fish & Fisheries (WGHIST)</font> </div><div><font color="#888888"><a href="mailto:esklein04@gmail.com" target="_blank">esklein04@gmail.com</a></font></div><div dir="ltr"><br></div><div dir="ltr"><a href="http://www.bu.edu/pardee/" target="_blank">http://www.bu.edu/pardee/</a><font color="#888888"><br></font></div></div><div dir="ltr"><a href="http://www.ices.dk/community/groups/Pages/WGHIST.aspx" target="_blank">http://www.ices.dk/community/groups/Pages/WGHIST.aspx</a><font color="#888888"><br></font></div><div dir="ltr"><br></div><div dir="ltr"><br><br></div></div></div></div></div></div></div></div>