Announcement

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

  • After estimation, how can I obtain predictions at the mean of some of the covariates?

    I know that after estimation if I replace some of the covariates with their means and predict, I can get what I want but there is got to be a built in option for something like that which seems to be escaping me. Is there?

  • #2
    Code:
    help margins

    Comment


    • #3
      Daniel,
      I never worked with margins. I looked at margins and understand I can make coefficient comparisons, testing significance of coefficient estimates, etc but how do I get the predicted values in terms of like "predict newvar"? It is totally escaping me.

      Comment


      • #4
        I see in help margins i can predict means of all independent variables but if I have 3 ind vars like X1-X3 and want predictions at the means of X1 and X2 would the syntax be like at((mean) X1 X2) ?

        Comment


        • #5
          You may find the explanation you need, and more, in the nice overview of margins prepared by Richard Williams, a frequent contributor here, at https://www3.nd.edu/~rwilliam/xsoc73994/Margins01.pdf with a more detailed paper in the Stata Journal at http://www.stata-journal.com/article...article=st0260. I'll also note that Margins01.pdf is followed by Margins02.pdf ... Margins05.pdf covering more specialized topics.

          Comment


          • #6
            Originally posted by William Lisowski View Post
            You may find the explanation you need, and more, in the nice overview of margins prepared by Richard Williams, a frequent contributor here, at https://www3.nd.edu/~rwilliam/xsoc73994/Margins01.pdf with a more detailed paper in the Stata Journal at http://www.stata-journal.com/article...article=st0260. I'll also note that Margins01.pdf is followed by Margins02.pdf ... Margins05.pdf covering more specialized topics.
            Thanks William. I looked at margins help. at option allows only a subset of observations or specific values provided using a notation like (2(1)100). What I want is predicted values for each observation assuming all other variables are at their means. then i looked at predictnl I believe and it allows predictions based on the estimated equation where you can set the coefficients to certain values or can restrict them but does not seem to allow an automated way of doing that, I plan on using this feature in a rolling modeling context and if it cant be automated easily then I would have to use the replace method. I dont think there exists anything like what I am looking for.

            Comment


            • #7
              The code in #4 looks fine. How does it not give you what you want? Can you provide a simple example?

              Comment

              Working...
              X