I have time-series dyadic data and need to run a regression (DV and IVs are absolute differences) with standard errors clustered by a dyad. However, my data is somehow unstructured in a sense that it is not correct to use the egen, group() to create a unique ID for a dyad. This is the example of my data set:
Code:
input firm_id1 firm_id2 year y_abs_dif x_abs_dif 1 2 2010 10 1 2 1 2011 15 3 1 2 2012 20 5 3 4 2010 50 3 3 4 2011 60 7 4 3 2012 70 9 end
Code:
egen dyad_id=group(firm_id1 firm_id2)
Code:
+------------------------------------------------------------+ | firm_id1 firm_id2 year y_abs_~f x_abs_~f dyad_id | |------------------------------------------------------------| 1. | 1 2 2010 10 1 1 | 2. | 2 1 2011 15 3 2 | 3. | 1 2 2012 20 5 1 | 4. | 3 4 2010 50 3 3 | 5. | 3 4 2011 60 7 3 | |------------------------------------------------------------| 6. | 4 3 2012 70 9 4 | +------------------------------------------------------------+
Code:
replace dyad_id = 1 in 2 replace dyad_id = 3 in 6
I would be grateful for your help.
0 Response to Dyadic data and clustered standard errors
Post a Comment