Hello,
I am using Stata Version 14.2. I am trying to use the combomarginsplot command to create a single marginsplot of multiple margins from a single regression (using xtreg).
Here is an example of the code I am using:
xtreg depvar c.(interactionvar1 intreactionvar2 interactionvar3)##c.indepvar1 controlvar1 controlvar2///
margins, dydx(indepvar1) at(interactionvar1=(-2 -1 0 1 2)) saving(m_1, replace)///
margins, dydx(indepvar1) at(interactionvar2=(-2 -1 0 1 2)) saving(m_2, replace)///
margins, dydx(indepvar1) at(interactionvar3=(-2 -1 0 1 2)) saving(m_3, replace)///
combomarginsplot m_1 m_2 m_3, labels ("Margins 1" "Margins 2" "Margins 3")///
At the end of this, I receive the following results and error code:
Warning: statistics differ for interactionvar1: file 1=values, file 3=asobserved; using first (values)
Warning: statistics differ for interactionvar3: file 1=asobserved, file 3=values; using values
Warning: statistics differ for interactionvar2: file 2=values, file 3=asobserved; using first (values)
Warning: statistics differ for interactionvar3: file 2=asobserved, file 3=values; using values
Warning: statistics differ for interactionvar1: file 1=values, file 2=asobserved; using first (values)
Warning: statistics differ for interactionvar2: file 1=asobserved, file 2=values; using values
local: _at3 master: _at1
file 2 _u_at_vars don't match file 1
r(198);
I am not sure what exactly this means nor what I am doing wrong here.
I am guessing that maybe the issue is with using the dydx command for the margins of interactions? I use this because I am interested in the average marginal effect of my independent variable of interest when interacted with my three different interaction variables (i.e., interactionvar1, interactionvar2, interactionvar3). If this is the issue, I wonder if the preferred alternative approach for this would be combining three separate marginsplots graphs into a single graph or using an alternative margins command to dydx.
I apologize if this did not make sense. Any advice anyone might have for me would be VERY appreciated.
Thank you!!!
I am using Stata Version 14.2. I am trying to use the combomarginsplot command to create a single marginsplot of multiple margins from a single regression (using xtreg).
Here is an example of the code I am using:
xtreg depvar c.(interactionvar1 intreactionvar2 interactionvar3)##c.indepvar1 controlvar1 controlvar2///
margins, dydx(indepvar1) at(interactionvar1=(-2 -1 0 1 2)) saving(m_1, replace)///
margins, dydx(indepvar1) at(interactionvar2=(-2 -1 0 1 2)) saving(m_2, replace)///
margins, dydx(indepvar1) at(interactionvar3=(-2 -1 0 1 2)) saving(m_3, replace)///
combomarginsplot m_1 m_2 m_3, labels ("Margins 1" "Margins 2" "Margins 3")///
At the end of this, I receive the following results and error code:
Warning: statistics differ for interactionvar1: file 1=values, file 3=asobserved; using first (values)
Warning: statistics differ for interactionvar3: file 1=asobserved, file 3=values; using values
Warning: statistics differ for interactionvar2: file 2=values, file 3=asobserved; using first (values)
Warning: statistics differ for interactionvar3: file 2=asobserved, file 3=values; using values
Warning: statistics differ for interactionvar1: file 1=values, file 2=asobserved; using first (values)
Warning: statistics differ for interactionvar2: file 1=asobserved, file 2=values; using values
local: _at3 master: _at1
file 2 _u_at_vars don't match file 1
r(198);
I am not sure what exactly this means nor what I am doing wrong here.
I am guessing that maybe the issue is with using the dydx command for the margins of interactions? I use this because I am interested in the average marginal effect of my independent variable of interest when interacted with my three different interaction variables (i.e., interactionvar1, interactionvar2, interactionvar3). If this is the issue, I wonder if the preferred alternative approach for this would be combining three separate marginsplots graphs into a single graph or using an alternative margins command to dydx.
I apologize if this did not make sense. Any advice anyone might have for me would be VERY appreciated.
Thank you!!!
Comment