Dear Statalisters:
I've been playing around with -margins- lately, and I am using the dydx options for the first time. I think I know how dydx works, but I'm not sure.
Let's say I run a regression and then calculate out the marginal effect using dydx:
Where female is a dummy variable and age is continuous, and race is three categories (White, Black, Other). My understanding in this case is that it calculates out the average effect size for age and female over the sample when you increase x by 1, which is the same as the coefficient.
If I were to then add a polynomial term, so that:
My understanding is that this would give me the average effect size for age just like before, but this time it would the average effect size for both age and age-squared when you increase age by 1. This is where I stop being able to verify things easily just by looking at the output, since the marginal effect for age is now split across two variables.
Now let's say I want to compare black respondents to white and "other" respondents:
So now "black" is a dummy variable where black==0 is race==1 & race==3. My understanding is that I would now get two average effect sizes. The one for black==1 would be the average effect size over race==2 when age increases by 1, and would take into account both the nonlinearities of the squared age term but also . Meanwhile, the black==0 would be the average effect size of an increase of 1 for age among race==1 & race==3 . My understanding is that this average effect for black==0 would be due to both the coefficients for all the interactions with i.race, but also the size of the subpopulation of race==1 vs race==3.
Do I have this correct so far? Or am I off?
Thanks so much for your time,
Jonathan
I've been playing around with -margins- lately, and I am using the dydx options for the first time. I think I know how dydx works, but I'm not sure.
Let's say I run a regression and then calculate out the marginal effect using dydx:
Code:
regress y age i.female i.race margins, dydx (age female)
If I were to then add a polynomial term, so that:
Code:
regress y c.age##c.age i.female i.race margins, dydx (age female)
Now let's say I want to compare black respondents to white and "other" respondents:
Code:
regress y c.age##c.age##i.race margins, dydx (age), over(black)
Do I have this correct so far? Or am I off?
Thanks so much for your time,
Jonathan
Comment