Hello all,

i am currently trying to run an iv regression with fixed effects. I need to instrument esg_single with president, election, and state_government (these 3 instruments are all election data).
additionally i want to add an interaction term between the instrumented esg_single and advertising_lag1.
So far i have done this.

I need to cluster firm and year and i think this is not correct as well but first i have to find out about the iv regressions. If somebody has an idea, he can mention it

Best wishes, Patrick

Code:
. xtset company_key year
       panel variable:  company_key (strongly balanced)
        time variable:  year, 2002 to 2019
                delta:  1 unit

. xtivreg firm_beta_w diversification_lag1 RnD_lag1 advertising_lag1 leverage_lag1 capex_lag1 cash_lag1 size_lag1 earnings_variability_lag1 state_tax_lag1 cash_flo
> w_lag1 (esg_single = president congress state_government), fe vce (cluster company_key)

Fixed-effects (within) IV regression            Number of obs     =      5,078
Group variable: company_key                     Number of groups  =        401

R-sq:                                           Obs per group:
     within  =      .                                         min =          1
     between = 0.0010                                         avg =       12.7
     overall = 0.0006                                         max =         17


                                                Wald chi2(11)     =      51.28
corr(u_i, Xb)  = -0.4494                        Prob > chi2       =     0.0000

                                       (Std. Err. adjusted for 401 clusters in company_key)
-------------------------------------------------------------------------------------------
                          |               Robust
              firm_beta_w |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------------------+----------------------------------------------------------------
               esg_single |   1.097864   .6710295     1.64   0.102    -.2173294    2.413058
     diversification_lag1 |   .0039309   .0073202     0.54   0.591    -.0104164    .0182783
                 RnD_lag1 |  -1.078005   .6857831    -1.57   0.116    -2.422116    .2661047
         advertising_lag1 |  -.0995546    .223759    -0.44   0.656    -.5381141     .339005
            leverage_lag1 |   .0135304   .1455234     0.09   0.926    -.2716902     .298751
               capex_lag1 |  -.0557879   .0283654    -1.97   0.049    -.1113831   -.0001927
                cash_lag1 |  -.0000355   .0043581    -0.01   0.994    -.0085773    .0085063
                size_lag1 |  -.1962793   .0974041    -2.02   0.044    -.3871878   -.0053709
earnings_variability_lag1 |   .0009149   .0053712     0.17   0.865    -.0096124    .0114421
           state_tax_lag1 |   .8038821   .8323541     0.97   0.334    -.8275019    2.435266
           cash_flow_lag1 |  -.6247935   .3121108    -2.00   0.045    -1.236519   -.0130676
                    _cons |    3.82352   1.353956     2.82   0.005     1.169815    6.477224
--------------------------+----------------------------------------------------------------
                  sigma_u |   .3612004
                  sigma_e |  .34487011
                      rho |  .52311604   (fraction of variance due to u_i)
-------------------------------------------------------------------------------------------
Instrumented:   esg_single
Instruments:    diversification_lag1 RnD_lag1 advertising_lag1 leverage_lag1 capex_lag1
                cash_lag1 size_lag1 earnings_variability_lag1 state_tax_lag1 cash_flow_lag1
                president congress state_government