<p>After reading more about robust linear regression, I think I better understand the source of the problem. As outlined in <a href="https://arxiv.org/pdf/1208.5595.pdf" rel="nofollow noreferrer">this paper</a> and alluded to in the <a href="https://rdrr.io/rforge/robustbase/man/lmrob.control.html" rel="nofollow noreferrer">docs for lmrob.control</a>, the first step of a robust regression involves sub sampling the input data. In cases with many categorical predictors, there is a higher likelihood that the sub-sample will contain co-linear columns which results in a matrix that is not full rank and hence the reported "DGELS" error. The "KS2011" and "KS2014" settings in lmrob allow you to specify that the algorithm should take extra care to avoid co-linear columns when picking a sub-sample, however in cases where the number of data points is not much bigger than the number of variables in the model (as is sometimes the case for my application), the algorithm still cannot find a non-singular data subset from the initial starting point and it still fails. This doesn't explain why restarting a new R session can help lmrob find a non-singular subset, but it does explain why this is a difficult problem that often throws errors.</p>
DGELS "full rank" error from lmrob
<p>In R, I'm using lmrob from the robustbase package to fit a simple linear model of the form:</p>

<pre><code>lmrob(value ~ t + as.factor(r) + as.factor(c) + 0, data=subs, setting="KS2014")
</code></pre>

<p>This works fine 95% of the time, but every once in a while the call fails and gives this error:</p>

<blockquote>
  <p>Error: DGELS: weighted design matrix not of full rank (column XX).</p>
</blockquote>

<p>where XX is varying column number. I can fix this by simply executing the lmrob command repeatedly until it finally succeeds -- usually this take 1-2 tries until it works. Note that I am not changing any of the inputs when I rerun lmrob.</p>

<p>Does anyone know of a setting I can change to avoid having to manually re-run the lmrob command to get it to work? I've tried changing some of the control parameters without success:</p>

<pre><code>lm_control &lt;- lmrob.control(setting="KS2014")
lm_control$max.it &lt;- 1000
lm_control$nResample &lt;- 1500
</code></pre>