Dear statlist users,
I would like to display average marginal effects (AME) of a categorial variable conditioned on another interaction variable via -coefplot- after -margins, dydx() post-. I am estimating the AMEs of a categorial variable with 3 levels (rel_denom) for each level of the interaction variable with 4 levels (rel_imp) via the margins-command: all in all, there are 12 coefficients (3x4). However, coefplot only displays AMEs for the first level of the variable (rel_denom==1 vs. rel_denom==0) -- so only 4 coefficients are displayed, even though the margins-command shows all of them (see attachments).
Here is my code:
The matrix e(b) is a 1x16 matrix (see attachment), and the help-file of coefplot tells me it automatically should use the estimates of the first row. I tried to play around with the coefplot-b()-option, but am not sure how to tell coefplot to use all estimated coefficents of the first row.
With a categorial interaction variable like rel_imp, I could solve this problem estimating separate models for each level of rel_imp. However, I aime to use continuous interaction variables for rel_denom as well.
I would be glad if someone could give me a hint with this.
Anna
I would like to display average marginal effects (AME) of a categorial variable conditioned on another interaction variable via -coefplot- after -margins, dydx() post-. I am estimating the AMEs of a categorial variable with 3 levels (rel_denom) for each level of the interaction variable with 4 levels (rel_imp) via the margins-command: all in all, there are 12 coefficients (3x4). However, coefplot only displays AMEs for the first level of the variable (rel_denom==1 vs. rel_denom==0) -- so only 4 coefficients are displayed, even though the margins-command shows all of them (see attachments).
Here is my code:
Code:
xtreg depvar (i.rel_denom##i.rel_imp) if generation==0, fe vce(cluster schoolid) eststo m1: margins, dydx(rel_denom) over(rel_imp) post matrix list e(b) // 1x16 matrix coefplot m1 coefplot (m1, b(b[1,.])) // the default: take the first row of the matrix
With a categorial interaction variable like rel_imp, I could solve this problem estimating separate models for each level of rel_imp. However, I aime to use continuous interaction variables for rel_denom as well.
I would be glad if someone could give me a hint with this.
Anna

Comment