asdocx: Export from Stata to Word, Excel, LaTeX & HTML › Forums › asdocx Forum › Interactions to be shown correctly in the regression results table
-
AuthorPosts
-
Dear Dr Shah,
can you please let me know how could I get interactions shown correctly (instead of just “c” for each of them) in the docx regression results table? I use “label” option by asdocx to show full variable names – this works for all variables but not for the interaction effects ( (var1 x var2) and (var1 x var1 x var2) ). Any suggestions?
Function: asdocx xtreg [model variables here], fe vce(robust) append nest tzok drop(i.fyear) cnames(Model1) save(Model results.docx) table_layout(autofit) landscape dec(2) fs(8) add(Year dummy, Yes, Industry dummy, Yes) title(Coefficient Estimates from regression on TobinQ) label
Examplary part of the docx output:
Industry munificence, w 0.11
(0.13)
c 1.29
(0.82)
c -2.65**
(1.28)
Marketing intensity, w 0.71***
(0.07)
c 1.06**
(0.50)
c -1.88**
(0.90)Appreciate your help!
asdocx can report lables for variables, but not for interaction terms. You can suggest any standard practice in your field and I shall try to come up with a solution. For this, you may refer a paper or send your own example to show how interaction terms should be reported.
That would be really great feature! I believe normally it would be reported as:
VarA x VarB
VarA2 x VarB (with “2” being superscript as it is showing square effect)E.g. https://i.stack.imgur.com/KTcdN.jpg or here in the Fang et al article on p. 11 with quadratic effects: https://www.researchgate.net/figure/Firm-Level-Moderators-of-the-Effect-of-Service-Ratio-on-Firm-Value-A-Moderating-Effect_fig2_215915675
I have update the asdocx package. The update adds a new sub-command
change(old, new)
to flexmat to find and replace existing string with new string. Therefore, if you want to change the#
withx
, the option change will be used aschange("#", " x ")
. See the following example*update asdocx asdocx_update * Load example data sysuse auto * Estimate a regression with interaction terms asdocx reg price c.turn#c.trunk, replace nest 0 |1 2 ----+----------------------------------------------------------------------------- 1 | (1) 2 | price ----+----------------------------------------------------------------------------- 3 |c.turn#c.trunk 4.737*** 4 | (1.515) 5 |Intercept 3528.565*** 6 | (903.25) 7 |Observations 74 8 |R2 0.12 ---------------------------------------------------------------------------------- * Replace the # string with x flexmat change(#, " x ") 0 |1 2 ----+----------------------------------------------------------------------------- 1 | (1) ----+----------------------------------------------------------------------------- 2 | price 3 |c.turn x c.trunk 4.737*** 4 | (1.515) 5 |Intercept 3528.565*** 6 | (903.25) 7 |Observations 74 8 |R\super2 0.12 ---------------------------------------------------------------------------------- * Replace c. string with empty flexmat change(c., "") * Finally, export the modified table asdocx export
Thank you for the update. I believe you have missunderstood the issue I have encounted though… – it is not about changing “#” to “x”.
Let me try to explain again.If I use the the “label” option to have variable lable names shown instead of variable names used in the coding (e.g. “Industry munificence” instead of “imunif”), all interactions are shown as “” – without any name stated at all (!).
I get this (“/” is added to show separations between the columns):
“Industry munificence, w / 0.11 / (0.13)
c / 1.29 / (0.82)
c / -2.65** / (1.28)”Instead of the following:
“Industry munificence, w / 0.11 / (0.13)
Service relatedness x Industry munificence, w / 1.29 / (0.82)
Service relatedness x Service relatedness x Industry munificence, w / -2.65** / (1.28)”Or even better something like this, where “2” is superscript:
“Industry munificence, w / 0.11 / (0.13)
Service relatedness x Industry munificence, w / 1.29 / (0.82)
Service relatedness2 x Industry munificence, w / -2.65** / (1.28)”Or is there maybe existing solution already for this I don’t know about?
I have now updated the core of asdocx. It handles the interaction terms in a graceful manner. Following are few examples.
asdocx_update webuse nhanes2b * Interaction of continuous variables asdocx reg hgb hdresult c.tgresult#c.weight , nest replace abb(.) asdocx reg hgb hdresult c.tgresult#c.hct , nest abb(.)
Table: Regression results(1) (2) hgb hgb hdresult -0.019*** -0.016*** (0.002) (0.001) tgresult × weight 0*** (0) tgresult × hct 0*** (0) Intercept 14.951*** 14.575*** (0.096) (0.096) Observations 4222 4222 R\super2 0.08 0.107 Table: Regression results(1) (2) hgb hgb hdresult -0.013*** -0.009*** (0.001) (0.001) sex × tgresult 0.004*** (0) Female × tgresult -0.003*** (0) sex × tibc 0.004*** (0) Female × tibc 0 (0) Intercept 14.79*** 14.076*** (0.09) (0.09) Observations 4222 8720 R\super2 0.23 0.322 -
AuthorPosts
- You must be logged in to reply to this topic.