Page 1 of 1

Use of predict and margins post-estimation

Posted: Sat Jan 14, 2017 5:24 pm
by mariemurphy
Hello,

I have been attempting to obtain predictions in Stata following the fitting of my model (2 level cross-classified model using mcmc)

I found this post particularly useful in obtaining my yhat and associated standard errors:
https://www.cmm.bristol.ac.uk/forum/vie ... a2112#p452

I was hoping to calculate margins and plot the results via marginsplot as this has produced some very nice graphs for me in the past using simple linear regression. However, I get the following error after running my syntax:

predict yhatCC5
predict yhatCC5_se, stdp
gen yhatCC5_lb = yhatCC5 - 1.96 * yhatCC5_se
gen yhatCC5_ub = yhatCC5 + 1.96 * yhatCC5_se

margins, dydx(*)
Warning: cannot perform check for estimable functions.
variable var not found
r(111);

I wondered if anyone had success in using margins post estimation and might be able to advise?

Thanks in advance for your help.

Best wishes,
Marie

Re: Use of predict and margins post-estimation

Posted: Tue Jan 24, 2017 10:07 am
by GeorgeLeckie
Hi Marie,

I'm afraid you will have to make your graphs from first principles. We have not done anything in runmlwin to allow margins to work with it; it is a non-trivial task.

Best wishes

George