Dear all,

I am having some trouble with my margins command after -gsem-. Here below my data looks like with the codes for the models/results. I have not used -gsem- much before, could anyone possibly shed some light please on the error message "prediction is a function of possibly stochastic quantities other than e(b)". I essentially would like to use the marginsplot after the margins command.


Code:
gsem (x1 <- x2) (y <- c.visit##c.visit##x1 M1[id]), cov(e.x1*e.y)

//Result:

Generalized structural equation model           Number of obs     =      9,204

Response       : x1                             Number of obs     =      9,204
Family         : Gaussian
Link           : identity

Response       : y                              Number of obs     =      4,007
Family         : Gaussian
Link           : identity

Log likelihood = -15200.264

 ( 1)  [y]M1[id] = 1
------------------------------------------------------------------------------------
                   |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------------+----------------------------------------------------------------
x1                 |
                x2 |   .4505208   .0073391    61.39   0.000     .4361365    .4649052
             _cons |  -4.43e-12   .0051929    -0.00   1.000    -.0101779    .0101779
-------------------+----------------------------------------------------------------
y                  |
             visit |  -2.148707   .0975071   -22.04   0.000    -2.339818   -1.957597
                   |
   c.visit#c.visit |   .1313148   .0085292    15.40   0.000     .1145979    .1480317
                   |
              1.x1 |   1.246192   .7017901     1.78   0.076    -.1292914    2.621675
                   |
        x1#c.visit |
                1  |  -.1323187   .1542915    -0.86   0.391    -.4347245    .1700872
                   |
x1#c.visit#c.visit |
                1  |   .0035332   .0133594     0.26   0.791    -.0226506    .0297171
                   |
            M1[id] |          1  (constrained)
                   |
             _cons |   16.28748   .2392633    68.07   0.000     15.81853    16.75642
-------------------+----------------------------------------------------------------
        var(M1[id])|   13.25954   .8375103                      11.71559    15.00696
-------------------+----------------------------------------------------------------
          var(e.x1)|   .1239373    .001827                      .1204077    .1275703
           var(e.y)|   15.39041   .5084105                      14.42552    16.41984
-------------------+----------------------------------------------------------------
      cov(e.x1,e.y)|  -.2184486      .0986    -2.22   0.027     -.411701   -.0251963
------------------------------------------------------------------------------------


margins, at(x1=(0/1) visit=(0/11)) predict(outcome(y) fixed)

prediction is a function of possibly stochastic quantities other than e(b)