Dear all,

I have written the following program

Code:
program define myprog1

replace pseudoclass = irecode(runiform(),prob_1, prob_1 + prob_2, prob_1 + prob_2 + prob_3)
reg dep_var i.trial##i.pseudoclass
margins i.trial, at(pseudoclass=(1(1)3)) 
end
Now I want to conduct a simulation using the results of margins.

However, I can not see in the margins help file how to refer to the prdicted values.

If I run e.g.
Code:
simulate _se _b, reps(100): myprog1
It worlks perfectly.

However, If I run something like

Code:
simulate _margins, reps(100): myprog1
I get the error message
at values for factor pseudoclass do not sum to 1
an error occurred when simulate executed myprog1
Which does not make any sense to me as at values are not supposed to sum up to 1

Can anyone help me with retriving the predicted values.

Many Thanks