Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to incorporate random coefficients into SUR in Stata?

    Hi all,

    I'm running a SUR regression using sur command in Stata: sureg (dv1 iv1 iv2 iv3 iv4 i.dummy) (dv2 iv1 iv2 iv3 iv4 i.dummy) . I want to allow random coefficient for iv1, iv2 and intercept. Does anyone know how to do this in Stata except for the xtsur command?

    Thank you

  • #2
    gsem will do it. The syntax for constructing a random intercept and random slope is shown in Example 38g. In your case, you would use the same kind of syntax separately for each of your two equations (dependent variables).
    Code:
    help gsem
    With six random effects, patience.

    Comment


    • #3
      Originally posted by Joseph Coveney View Post
      gsem will do it. The syntax for constructing a random intercept and random slope is shown in Example 38g. In your case, you would use the same kind of syntax separately for each of your two equations (dependent variables).
      Code:
      help gsem
      With six random effects, patience.

      Hi Joseph,

      Thank you so much for your reply. I wonder if the code below is correct. But I'm a little bit confused how to allow the error terms of these two equations to be correlated?

      gsem (dv1 <-i.dummy M1[iv1] M1[iv2] M1[iv3] M1[iv4])
      gsem (dv2 <-i.dummy M1[iv1] M1[iv2] M1[iv3] M1[iv4])
      Thank you and look forward to your reply.

      Comment


      • #4
        It's not correct. And to answer your question, you allow (or disallow) correlated-error terms using the covariance() option. Take a closer look at that example (for specifying random slope terms) and the command's help file (for options).

        Especially with such a complicated statistical model, you'll probably want to sit down with pencil and paper and go through exactly the data-generating process that you're trying to model. I've never used it, but perhaps the SEM Builder might be helpful as an aid to sketch out the data-generating process.

        Comment


        • #5
          Originally posted by Joseph Coveney View Post
          It's not correct. And to answer your question, you allow (or disallow) correlated-error terms using the covariance() option. Take a closer look at that example (for specifying random slope terms) and the command's help file (for options).

          Especially with such a complicated statistical model, you'll probably want to sit down with pencil and paper and go through exactly the data-generating process that you're trying to model. I've never used it, but perhaps the SEM Builder might be helpful as an aid to sketch out the data-generating process.
          Hi Joseph,

          I checked the document again and had a brief idea of how to do that now. However, when I tried the command using Stata automobile dataset, I encounter an error like below:


          sysuse auto
          gsem ( price <- weight length ) ( mpg <- weight length ), cov(e. price *e. mpg )
          nothing found where name expected
          r(198);

          I tried the command without cov option and it works. I wonder if you know how to fix this error?

          Thanks and look forward to your reply.

          Comment


          • #6
            Originally posted by Joseph Coveney View Post
            It's not correct. And to answer your question, you allow (or disallow) correlated-error terms using the covariance() option. Take a closer look at that example (for specifying random slope terms) and the command's help file (for options).

            Especially with such a complicated statistical model, you'll probably want to sit down with pencil and paper and go through exactly the data-generating process that you're trying to model. I've never used it, but perhaps the SEM Builder might be helpful as an aid to sketch out the data-generating process.
            Hi Joseph (and for others who potentially meet the same issue),

            I have figured out why and the code below works. Thanks a lot for your help!

            gsem (price <- foreign mpg displacement c.mpg#M1[make]) ///
            (weight <- foreign length c.length#M1[make]), ///
            cov(e.price*e.weight)

            Comment

            Working...
            X