Stata 14 allegedly incorporates random effects into the margins command. However, I am currently using it and it does not seem to do this. For example, I fitted a 2-level random intercepts probit model using the xtprobit command with n independent variables:
xtprobit y x1 x2... xn, re
Next I used margins,
margins , dydx(x1)
Point estimates from this command are exactly the same in Stata 13.1 and in the current version of Stata 14. These are models where the Rho is estimated at .19, level 2 variance is significant. What gives?
Similarly, in a subset of these data I estimate a linear model using xtreg. The outcome variable is logged so I ask margins to give me average marginal effects using exponentially transformed coefficients,
margins , dydx(x) exp(exp(predict(xbu)))
According to the predict help file xbu is supposed to be the effect including the random component, but Stata gives me the error that "predict option xbu not appropriate with margins"
The command runs just fine when I ask for the prediction to be limited to the fixed effect only (i.e. "xb"). The margins help file even specifies that margins will only estimate the fitted values (xb) and that other options from the predict command, such as "u," are not available.
Am I misunderstanding something? I imagine that the mistake is on my end but I just don't understand. The new product documentation sure makes it look like the random effects should be accounted for using margins but in my models it sure doesn't look like this is the case. Here's a link to the new product demo I'm referring to. http://www.stata.com/stata14/marginal-margins/
Many thanks for any clarity you can provide.
xtprobit y x1 x2... xn, re
Next I used margins,
margins , dydx(x1)
Point estimates from this command are exactly the same in Stata 13.1 and in the current version of Stata 14. These are models where the Rho is estimated at .19, level 2 variance is significant. What gives?
Similarly, in a subset of these data I estimate a linear model using xtreg. The outcome variable is logged so I ask margins to give me average marginal effects using exponentially transformed coefficients,
margins , dydx(x) exp(exp(predict(xbu)))
According to the predict help file xbu is supposed to be the effect including the random component, but Stata gives me the error that "predict option xbu not appropriate with margins"
The command runs just fine when I ask for the prediction to be limited to the fixed effect only (i.e. "xb"). The margins help file even specifies that margins will only estimate the fitted values (xb) and that other options from the predict command, such as "u," are not available.
Am I misunderstanding something? I imagine that the mistake is on my end but I just don't understand. The new product documentation sure makes it look like the random effects should be accounted for using margins but in my models it sure doesn't look like this is the case. Here's a link to the new product demo I'm referring to. http://www.stata.com/stata14/marginal-margins/
Many thanks for any clarity you can provide.
Comment