title: Error with R lfe package felm call: rank problems, chol() problems
body: <p>I am using <em>R</em> to compute an instrumental variable regression. Specifically, I am calling <strong>felm</strong> from package <strong>lfe</strong>. The response variable is cost, and id and dates are factors that will be used for fixed effects. I am almost sure that my data is not rank deficient in any way, but no matter how I slice it, I keep getting this error:</p>
  
  <pre><code>Error in if (rank == N) return(chol(mat)) : argument is of length zero
  </code></pre>
  
  <p>When I tried debugging line by line, I was stepping deeper and deeper into various package function calls, and I couldn't make sense of it. Here's summary information about the data frame, limited to just the rows I'm feeding into the call. You can see that the only NA's are in the "cost" field.</p>
  
  <p><a href="https://i.stack.imgur.com/Cpvfg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cpvfg.png" alt="data frame summary"></a></p>
  
  <p>Here is the call that generates the "argument of length zero" error. </p>
  
  <pre><code>trial_model = felm(formula = cost ~ covariate.P_t | id + dates | (covariate.TiPt ~ covariate.AiPt) | id,data=rawDataSimple,subset=rows_to_use)
  </code></pre>
  
  <p>I get the same error when I include this argument:</p>
  
  <pre><code>na.action=na.omit
  </code></pre>
  
  <p>I get the same error when I also include this argument:</p>
  
  <pre><code>exactDOF="rM"
  </code></pre>
  
  <p>So I'm stuck. Any thoughts on how to diagnose this problem, either in the felm call or in my data frame?</p>