Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Instrumental Variable (IV) estimation within interaction term in a three-dimensional panel dataset

    Hello everyone,

    I'm trying to do an Instrumental Variable (IV) estimation for an endogenous variable within an interaction term. Furthermore, I use a three-dimensional panel dataset. My dataset includes 4864 supplier-customer relationships. Each row in my dataset contains the id of the supplier (id_supplier), the id of the customer (id_customer), the sustainability value of the supplier (value_supplier), the sustainability value of the customer (value_customer), the exogenous sustainability pressure of the customer (iv) a variable that indicates if the relationship was active in that year (rel_active) and the year (year) of the observation. Moreover, control variables for the supplier (control_supplier) and for the customer (control_customer) are included. In some rows, the control variables are missing. Note that value_supplier, value_customer, rel_active and iv are all binary. Furthermore, note that some suppliers and customers have multiple supplier-customer relationships and occur multiple times in the dataset. Below you can find an example dataset. I try to estimate b in the following equation:
    value_supplier = a + b*rel_act*value_customer + g*control_supplier + l*control_customer + e (1)

    In order to do this, I use the following code:
    Code:
    reghdfe value_supplier c.value_customer#c.rel_act control_supplier control_customer, absorb(year id_customer id_supplier) cluster(id_customer id_supplier)
    In the previous setting, value_customer is expected to be endogenous. Hence, I want to instrument it with iv . The first stage estimation would look like this:
    value_customer = a1 + b1*iv + l1*control_customer + e1 (2)
    The second stage would again be the same as equation (1).

    I tried the following:
    Code:
    ivreghdfe value_supplier (c.value_customer#c.rel_act = c.iv#c.rel_act) control_supplier control_customer, absorb(year id_customer id_supplier) cluster(id_customer id_supplier)
    However, this instruments the full interaction term, while I only want to instrument a specific part of the interaction term. More specifically, I want to instrument value_customer with iv and multiply this estimate with rel_act. Furthermore, I only want to use the control variable for the customer (control_customer) in the first stage, while in the second stage I want to include both the supplier and customer control variables. Can someone help me out to do this in Stata?

    This is the first time I make use of this platform so please let me know if anything is not clear. Thank you in advance for your time.


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(id_supplier id_customer year value_supplier value_customer rel_act iv control_supplier control_customer)
    297 1 2011 1 0 1 1 11.639135  7.345152
    297 1 2012 1 0 1 1 11.665071  7.538813
    297 1 2013 1 0 0 1 11.688667  7.533293
    297 1 2014 1 0 0 1 11.745806  7.658811
    297 1 2015 1 0 0 1 11.674466   7.69298
    297 1 2016 1 0 0 1 11.612725   7.67313
    297 1 2017 1 0 0 1 11.673938  7.732457
    297 1 2018 1 0 0 1 11.738913  8.246067
    297 1 2019 1 0 0 1  11.72304  8.196299
    297 1 2020 1 1 0 1 11.932858  8.214087
    297 2 2011 1 0 0 1 11.639135 11.523262
    297 2 2012 1 0 1 1 11.665071   11.6708
    297 2 2013 1 1 1 1 11.688667  11.78367
    297 2 2014 1 1 1 1 11.745806  11.70608
    297 2 2015 1 1 1 1 11.674466 11.693303
    297 2 2016 1 1 0 1 11.612725 11.680945
    297 2 2017 1 1 0 1 11.673938 11.773896
    297 2 2018 1 1 0 1 11.738913  11.82932
    297 2 2019 1 1 0 1  11.72304 11.852294
    297 2 2020 1 1 0 1 11.932858 11.936676
    628 2 2011 0 0 0 1  5.331902 11.523262
    628 2 2012 0 0 0 1  5.630122   11.6708
    628 2 2013 0 1 0 1  6.251455  11.78367
    628 2 2014 0 1 0 1  6.396355  11.70608
    628 2 2015 0 1 0 1  6.677984 11.693303
    628 2 2016 0 1 1 1  6.789804 11.680945
    628 2 2017 0 1 0 1  7.197271 11.773896
    628 2 2018 0 1 0 1  7.409732  11.82932
    628 2 2019 0 1 0 1  7.487259 11.852294
    628 2 2020 0 1 0 1         . 11.936676
    664 2 2011 1 0 0 1   9.45995 11.523262
    664 2 2012 1 0 1 1  9.663421   11.6708
    664 2 2013 1 1 1 1  9.721091  11.78367
    664 2 2014 1 1 1 1  9.733117  11.70608
    664 2 2015 1 1 1 1  9.794256 11.693303
    664 2 2016 1 1 0 1  9.812799 11.680945
    664 2 2017 1 1 0 1  9.933483 11.773896
    664 2 2018 1 1 0 1 10.029675  11.82932
    664 2 2019 1 1 0 1 10.104348 11.852294
    664 2 2020 1 1 0 1 10.301924 11.936676
    223 3 2011 1 0 0 1  8.384896  10.60933
    223 3 2012 1 0 0 1  8.661746  10.72179
    223 3 2013 1 0 0 1  8.756004  10.64137
    223 3 2014 1 1 0 1  8.836883 10.606857
    223 3 2015 1 1 1 1  8.813504 10.570445
    223 3 2016 1 1 1 1  8.897864  10.51461
    223 3 2017 1 1 0 1  8.834514 10.494575
    223 3 2018 1 1 0 1  8.834119  10.40765
    223 3 2019 1 1 0 1  8.870854 10.389642
    223 3 2020 1 1 0 1  8.924748  10.42371
    228 3 2011 0 0 0 1  8.402884  10.60933
    228 3 2012 0 0 0 1  8.438716  10.72179
    228 3 2013 0 0 1 1  8.478651  10.64137
    228 3 2014 0 1 1 1  8.524513 10.606857
    228 3 2015 0 1 1 1 8.5107765 10.570445
    228 3 2016 0 1 0 1   8.53775  10.51461
    228 3 2017 0 1 0 1  8.457214 10.494575
    228 3 2018 0 1 0 1 8.4991255  10.40765
    228 3 2019 0 1 0 1  8.437344 10.389642
    228 3 2020 0 1 0 1  8.500991  10.42371
    236 3 2011 0 0 0 1  5.210557  10.60933
    236 3 2012 0 0 0 1  5.354584  10.72179
    236 3 2013 0 0 0 1  5.498945  10.64137
    236 3 2014 0 1 0 1  5.635346 10.606857
    236 3 2015 0 1 0 1  5.721793 10.570445
    236 3 2016 0 1 1 1  5.711586  10.51461
    236 3 2017 0 1 1 1  5.754479 10.494575
    236 3 2018 0 1 0 1  5.899917  10.40765
    236 3 2019 0 1 0 1  6.074744 10.389642
    236 3 2020 0 1 0 1  6.106804  10.42371
    310 3 2011 0 0 0 1  8.637799  10.60933
    310 3 2012 0 0 1 1  8.727941  10.72179
    310 3 2013 0 0 1 1  8.763412  10.64137
    310 3 2014 0 1 0 1  8.914007 10.606857
    310 3 2015 0 1 0 1 8.9985075 10.570445
    310 3 2016 0 1 0 1  9.028938  10.51461
    310 3 2017 0 1 0 1  9.084494 10.494575
    310 3 2018 1 1 0 1  9.126818  10.40765
    310 3 2019 1 1 0 1  9.155863 10.389642
    310 3 2020 1 1 0 1  9.188789  10.42371
    399 3 2011 0 0 0 1  7.840037  10.60933
    399 3 2012 0 0 0 1   7.96419  10.72179
    399 3 2013 0 0 0 1  8.284226  10.64137
    399 3 2014 0 1 0 1  8.388246 10.606857
    399 3 2015 0 1 0 1    8.4487 10.570445
    399 3 2016 0 1 0 1  8.541574  10.51461
    399 3 2017 0 1 0 1    8.5806 10.494575
    399 3 2018 0 1 0 1  9.058843  10.40765
    399 3 2019 0 1 0 1  9.161801 10.389642
    399 3 2020 1 1 0 1  9.236495  10.42371
    450 3 2011 0 0 0 1  9.201338  10.60933
    450 3 2012 0 0 0 1  9.295307  10.72179
    450 3 2013 0 0 0 1 9.3210125  10.64137
    450 3 2014 0 1 0 1   9.43675 10.606857
    450 3 2015 0 1 0 1  9.493589 10.570445
    450 3 2016 0 1 0 1  9.416951  10.51461
    450 3 2017 0 1 0 1  9.397379 10.494575
    450 3 2018 0 1 1 1  9.647943  10.40765
    450 3 2019 1 1 1 1   9.63692 10.389642
    450 3 2020 1 1 0 1  9.774329  10.42371
    end
Working...
X