Following the examples of e.g. https://www.stata.com/features/overv...evel-modeling/ I am estimating a hierarchical model with random effects of a categorical variable (here: foreign) and its interaction with a dummy I am interested in (here: dummy). Simplified, my analysis looks like this:
I want to generate fitted values and calculate marginal effects for the categorical variable (foreign) and its interaction with the dummy (dummy). In frequentist analysis such as "regress", I would simply use the commands "predict" and "margins". However, it seems like these options are not supported for bayesmh. Is there an alternative in Stata (18)? The code & errors for predict and margins (after running the model above):
Error: requested action not valid after most recent estimation command r(321);
Error: last estimates not found r(301);
Furthermore, I'd also be thankful for someone showing me how to calculate the marginal effects of the interaction in this setting, i.e. whether it's possible to refer to the object simply as "c.dummy#U1[foreign]".
Code:
webuse auto, clear gen dummy = runiformint(0,1) bayesmh price dummy U0[foreign] c.dummy#U1[foreign], /// likelihood(normal({var_0})) /// prior({price: _cons dummy}, normal(0,10)) /// prior({var_U0 var_U1 var_0}, igamma(2.001, 1.001) split) /// block({var_0} {var_U0} {var_U1}) /// showreffects /// rseed(38593150)
Code:
predit p_price
Code:
margins foreign
Furthermore, I'd also be thankful for someone showing me how to calculate the marginal effects of the interaction in this setting, i.e. whether it's possible to refer to the object simply as "c.dummy#U1[foreign]".
Comment