title: include panel-specific trends in a first-difference regression
body: <p>I was wondering if there's a way to include panel-specific or just varying trends in a first-difference regression when clustering on the panel id and the time variable.</p>
  
  <p>Here's an example of with Stata:</p>
  
  <pre><code>. webuse nlswork
  (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
  
  . ivreg2 S1.(ln_wage tenure) , cluster(idcode year)
  
  OLS estimation
  --------------
  
  Estimates efficient for homoskedasticity only
  Statistics robust to heteroskedasticity and clustering on idcode and year
  
  Number of clusters (idcode) =     3660                Number of obs =    10528
  Number of clusters (year) =          8                F(  1,     7) =     2.81
                                                        Prob &gt; F      =   0.1378
  Total (centered) SS     =  1004.098948                Centered R2   =   0.0007
  Total (uncentered) SS   =  1035.845686                Uncentered R2 =   0.0314
  Residual SS             =   1003.36326                Root MSE      =    .3087
  
  ------------------------------------------------------------------------------
               |               Robust
     S.ln_wage |      Coef.   Std. Err.      z    P&gt;|z|     [95% Conf. Interval]
  -------------+----------------------------------------------------------------
        tenure |
           S1. |   .0076418   .0042666     1.79   0.073    -.0007206    .0160043
               |
         _cons |   .0501738   .0070986     7.07   0.000     .0362608    .0640868
  ------------------------------------------------------------------------------
  Included instruments: S.tenure
  ------------------------------------------------------------------------------
  
  . ivreg2 S1.(ln_wage tenure i.c_city), cluster(idcode year)
  factor variables not allowed
  r(101);
  </code></pre>
  
  <p>In the specification above, the constant corresponds to a common time trend. Putting the factor variable outside the seasonal difference operator errors as well.</p>
  
  <p>I understand that the differencing operator does not play well with factor variables or interactions, but I feel there must be some hack to get around that.</p>
  
  <p>The <code>ivreg2</code> is a bit of a red herring. I am not doing IV estimation, I just want to use two-way clustering.</p>