Hello everyone,
I am writing to ask for your help on one of my projects. I have data on employment and value-added in several manufacturing industries in several countries. In fact, I have 17 industry sub-sectors (textiles, food and beverages, basic metals, etc.) for nine countries over a period of more than twenty years (1990-2014). For the sake of my analysis, I'm looking at the period 2002-2014 to see if it corresponds to a period of deindustrialization or industrialization in my industries (employment and value-added).
After estimating a very general regression to study the trend of industrialization or de-industrialization over my period of interest (thanks to a dummy taking 1 for the years of interest to me), I wanted to take the descriptive analysis a step further by first investigating heterogeneity within my countries. This is why I added an interaction term between my period of interest captured by a dummy (GP) and a dummy for each of the countries in my model. In this way, I was able to capture the heterogeneity by then calculating the marginal effect per country and plotting the estimate (for example) on a graph through the coeffplot command.
At this stage, all was working. My last step was now to try to capture the heterogeneity, over the period, between my countries and my sectors thanks to a triple interaction term. Given the number of sectors in my data (19), I grouped them into three dummy groups: a group of commodity-intensive industries (CI), labor-intensive industries (LI), and knowledge-intensive industries (KI). In other words, I have created three dummies, the first one taking "1" for sectors belonging to my first group and so on... Once I've made this, I ran a regression loop for my first commodity-intensive group where I included my triple interaction between my period (1), my dummy for each country (2), and my dummy for my first industry group (3). My idea was therefore to calculate the marginal effect in order to be able to represent the industrialization or de-industrialization trend of my country with respect to my commodity-intensive industries.
So I launched this code:
My problem is that it seems that Stata is not able to compute the margins for my dummy that assess my group number one, i.e. the dummy that takes "1" for the commodity-intensive industries. Am I doing something wrong (in my code or am I misunderstanding something about the triple-interaction term) ? Is it completely impossible for me to compute the margins then?
Thank you in advance for taking the time to read me! I would be very grateful if you could help me because I have to admit that I am buttering on this problem and don't know how to solve it or get around it...
I am writing to ask for your help on one of my projects. I have data on employment and value-added in several manufacturing industries in several countries. In fact, I have 17 industry sub-sectors (textiles, food and beverages, basic metals, etc.) for nine countries over a period of more than twenty years (1990-2014). For the sake of my analysis, I'm looking at the period 2002-2014 to see if it corresponds to a period of deindustrialization or industrialization in my industries (employment and value-added).
After estimating a very general regression to study the trend of industrialization or de-industrialization over my period of interest (thanks to a dummy taking 1 for the years of interest to me), I wanted to take the descriptive analysis a step further by first investigating heterogeneity within my countries. This is why I added an interaction term between my period of interest captured by a dummy (GP) and a dummy for each of the countries in my model. In this way, I was able to capture the heterogeneity by then calculating the marginal effect per country and plotting the estimate (for example) on a graph through the coeffplot command.
At this stage, all was working. My last step was now to try to capture the heterogeneity, over the period, between my countries and my sectors thanks to a triple interaction term. Given the number of sectors in my data (19), I grouped them into three dummy groups: a group of commodity-intensive industries (CI), labor-intensive industries (LI), and knowledge-intensive industries (KI). In other words, I have created three dummies, the first one taking "1" for sectors belonging to my first group and so on... Once I've made this, I ran a regression loop for my first commodity-intensive group where I included my triple interaction between my period (1), my dummy for each country (2), and my dummy for my first industry group (3). My idea was therefore to calculate the marginal effect in order to be able to represent the industrialization or de-industrialization trend of my country with respect to my commodity-intensive industries.
So I launched this code:
Code:
eststo clear levelsof Country_ABV, local(Country_local) foreach x of local Country_local { gen `x'= 0 replace `x'=1 if Country_ABV == "`x'" eststo Model1_`x': reg Share_Employment_Sectors_WP $Controls i.GP##`x'##Group1_CI i.Country i.Sectors, cluster(Country) margins, dydx(i.GP Group1_CI) over(`x') eststo M_Model1_`x': margins if `x'==1, dydx(i.GP Group1_CI) post drop `x' }
Code:
Linear regression Number of obs = 3,556 F(7, 8) = . Prob > F = . R-squared = 0.6406 Root MSE = .00275 (Std. err. adjusted for 9 clusters in Country) --------------------------------------------------------------------------------------------------- | Robust Share_Employment_Sectors_WP | Coefficient std. err. t P>|t| [95% conf. interval] ----------------------------------+---------------------------------------------------------------- LogPopSize | -.0560195 .0097019 -5.77 0.000 -.078392 -.033647 LogPopSize_2 | .0015563 .0003114 5.00 0.001 .0008381 .0022745 Log_GDPPC | .0420228 .008513 4.94 0.001 .0223917 .0616539 Log_GDPPC_2 | -.0023456 .0004804 -4.88 0.001 -.0034535 -.0012378 1.GP | .0002734 .0004878 0.56 0.590 -.0008515 .0013984 1.URY | -.008507 .0024309 -3.50 0.008 -.0141126 -.0029015 | GP#URY | 1 1 | -.001076 .0003665 -2.94 0.019 -.0019212 -.0002309 | 1.Group1_CI | -.0000186 .0004979 -0.04 0.971 -.0011667 .0011296 | GP#Group1_CI | 1 1 | .0002944 .0002851 1.03 0.332 -.000363 .0009518 | URY#Group1_CI | 1 1 | .0018881 .0003053 6.18 0.000 .001184 .0025921 | GP#URY#Group1_CI | 1 1 1 | .0011365 .0002772 4.10 0.003 .0004974 .0017756 | Country | Brazil | .0038352 .0062795 0.61 0.558 -.0106454 .0183158 Chile | .0018552 .0006698 2.77 0.024 .0003105 .0033998 Colombia | .0034393 .0026464 1.30 0.230 -.0026633 .0095418 Costa Rica | -.0049458 .0021438 -2.31 0.050 -.0098894 -2.16e-06 Ecuador | -.0005481 .0005711 -0.96 0.365 -.0018651 .0007689 Mexico | .003599 .0046459 0.77 0.461 -.0071145 .0143125 Peru | .0048443 .0018613 2.60 0.031 .0005522 .0091365 Uruguay | 0 (omitted) | Sectors | Chemicals and chemical products | .0017007 .0004658 3.65 0.006 .0006265 .002775 Coke,refined petroleum product.. | -.0010946 .0004265 -2.57 0.033 -.0020782 -.0001111 Electrical machinery and appar.. | .0003235 .0005114 0.63 0.545 -.0008558 .0015028 Fabricated metal products | .0014142 .0003606 3.92 0.004 .0005828 .0022457 Food and beverages | .0135147 .0026814 5.04 0.001 .0073312 .0196981 Furniture; manufacturing n.e.c. | .0013932 .0007604 1.83 0.104 -.0003601 .0031466 Leather, leather products and .. | .000844 .0005114 1.65 0.137 -.0003353 .0020234 Machinery and equipment n.e.c. | .0007128 .0003188 2.24 0.056 -.0000224 .001448 Motor vehicles, trailers, semi.. | .0006206 .0005287 1.17 0.274 -.0005985 .0018398 Non-metallic mineral products | .0007444 .0003736 1.99 0.081 -.000117 .0016058 Paper and paper products | -.0003375 .0003631 -0.93 0.380 -.0011749 .0004999 Printing and publishing | .0006195 .0004412 1.40 0.198 -.000398 .001637 Rubber and plastics products | .0014244 .0005439 2.62 0.031 .0001702 .0026786 Textiles | .002277 .0007656 2.97 0.018 .0005116 .0040424 Wearing apparel, fur | .0046928 .001946 2.41 0.042 .0002053 .0091803 Wood products (excl. furniture) | 0 (omitted) | _cons | .3126299 .0863151 3.62 0.007 .113587 .5116728 --------------------------------------------------------------------------------------------------- Average marginal effects Number of obs = 3,556 Model VCE: Robust Expression: Linear prediction, predict() dy/dx wrt: 1.GP 1.Group1_CI Over: URY ------------------------------------------------------------------------------ | Delta-method | dy/dx std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- 0.GP | (base outcome) -------------+---------------------------------------------------------------- 1.GP | URY | 0 | .0003784 .0004113 0.92 0.384 -.00057 .0013268 1 | -.0002841 .0001616 -1.76 0.117 -.0006569 .0000886 -------------+---------------------------------------------------------------- 0.Group1_CI | (base outcome) -------------+---------------------------------------------------------------- 1.Group1_CI | URY | 0 | . (not estimable) 1 | . (not estimable) ------------------------------------------------------------------------------ Note: dy/dx for factor levels is the discrete change from the base level. Average marginal effects Number of obs = 414 Model VCE: Robust Expression: Linear prediction, predict() dy/dx wrt: 1.GP 1.Group1_CI ------------------------------------------------------------------------------ | Delta-method | dy/dx std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- 1.GP | -.0002841 .0001616 -1.76 0.117 -.0006569 .0000886 1.Group1_CI | . (not estimable) ------------------------------------------------------------------------------ Note: dy/dx for factor levels is the discrete change from the base level. . end of do-file
Thank you in advance for taking the time to read me! I would be very grateful if you could help me because I have to admit that I am buttering on this problem and don't know how to solve it or get around it...
Comment