title: Displaying ivreg2 first stage statistics using estout in Stata
body: <p>I am trying to add first stage statistics from the <code>ivreg2</code> command, namely the A-P F stat, into the output for the first stage results using <code>estout</code>.  I am aware that these statistics are stored in the <code>e(first)</code> matrix from the second stage results, but I am having trouble figuring out how to present those statistics in the first stage results.  I have tried the following and neither works:</p>
  
  <pre><code>ivreg2 y `included' (q=z), first ffirst savefirst savefprefix(first_)
  estimates store m1
  estadd matrix first=first: first_q
  estimates restore first_q
  </code></pre>
  
  <p>and then tried including <code>APF</code> as a statistic in <code>estout</code> and it doesn't work.  I have also tried adding the lines:</p>
  
  <pre><code>matrix first=e(first)
  estadd scalar APF=first[7,1]
  </code></pre>
  
  <p>and that also doesn't work.  I also tried writing a new <code>_estadd_apf.ado</code> subcommand and couldn't get that to work, and tried using the <code>myel[#]</code> syntax described in the <code>estout</code> help file and that does not work either. (It seems that including brackets anywhere in the <code>stats()</code> option results in an error.)  I also tried the <code>aux()</code> option in the <code>esttab</code> wrapper and that didn't work.  </p>
  
  <p>When I type <code>matrix list first</code> I can see the correct APF value, but it is stored in a matrix rather than a scalar and <code>estout</code> will not include it in the table, the cells are just blank.  I also tried just defining a local scalar without using <code>estadd</code>, and that too doesn't work.  Any suggestions?</p>