Announcement

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

  • Mean of Predictions (Point Estimates)

    Hey guys,
    I was hoping you would help me clarify a post-estimation issue I am having in stata.
    Assume I run a regression:
    y= b0+ b1x1+b2x2.+ b3x3


    I can then use the predict command to get the predictions (point estimates) and standard errors at the observation level for:
    yhat=b0hat+b1hatx1+b2hatx2+b3hatx3
    My question is how do I get the mean prediction and its respective standard error?
    My belief is that using the mean command after getting the observation specific predictions (point estimates) as above would be wrong.
    Any advice towards solving this issue would be highly appreciated.
    Thanks.


  • #2
    Code:
    regress y x1 x2 x3
    margins
    The output of the -margins- command will be what you asked for.

    Comment


    • #3
      Hi,

      Thank you for the response.

      Sorry about that I should have clarified the question. I am using the "mysureg" command to run a clustered regression. I am therefore trying to get the predicted (point estimates) for the yhats and other combinations of which I require.
      I
      attempted to utilize the bootstrap but it doesn't seem to recognize the "mysureg" command. I therefore tried to run the bootstrap with just "sureg" command, this worked just fine. However, I need to run a clustered regression.

      I successfully got the point estimates by using predictnl (Utilizes the delta method) after running the regression. However, I would like to get the mean point estimate and its respective standard error (scalar) which will best represent the vector of point estimates computed.


      Thanks again I truly appreciate it.

      Comment


      • #4
        I am not familiar with "mysureg." Perhaps somebody who is can help.

        Comment


        • #5
          T
          hank you very much. Do you think whether there a way to circumvent using the code "mysureg" to get the point estimate. For example, the boostrap command requires one to input the "mysureg" command in its command for it to run. However, I don't believe the inclusion of "mysureg" command is essential in the delta method. I am having an issue computing the scalar point estimate as opposed to the vector estimates.

          Many thanks, I truly appreciate the advice and response.

          Comment


          • #6
            I'm sorry, but I don't really understand what you are doing. As I said, I don't know what -mysureg- is, and I don't know what it is that you are bootstrapping. Perhaps if you show the full code you are using it will be clearer; from what you are describing I have only my confusion.

            Comment


            • #7
              Hi again, this is what I am trying to estimate:
              >With mysureg command
              {mysureg ($y1list $x1list) ($y2list $x2list), cluster(clustvar) constraints(1 2 to n)}
              > Bootstrap command with mysureg
              {bootstrap theta= (1/((_b[$y1list:lnx])+(_b[$y1list:lnx_2]*(lnx))….so on , reps(100) seed(12345): mysureg ($y1list $x1list) ($y2list $x2list), cluster(clustvar) constraints(1 2 to n)}
              -Mysureg accommodates clustering but the bootstrap doesn't seem to recognize the command. (It will claim to run but will only pick the first observation in the data.)
              >Bootstrap command with sureg command without
              cluster(clustvar)
              {bootstrap theta= (1/((_b[$y1list:lnx])+(_b[$y1list:lnx_2]*(lnx))….so on , reps(100) seed(12345): sureg ($y1list $x1list) ($y2list $x2list), constraints(1 2 to n}
              -This runs ok, but I need to utilize clusters.
              >Bootstrap command with sureg command with cluster(clustvar)
              {bootstrap theta= (1/((_b[$y1list:lnx])+(_b[$y1list:lnx_2]*(lnx))….so on, reps(100) seed(12345): sureg ($y1list $x1list) ($y2list $x2list), cluster(clustvar) constraints(1 2 to n}
              -This doesn't run because as mentioned earlier, sureg command doesn't accommodate clustering.
              ***A little extra information***
              -What I am trying to obtain is a scalar estimate similar to the coefficient estimate provided by the nlcom command. However, to the best of my knowledge the nlcom command doesn't accommodate the inclusion of variables in its command:
              For example:
              -I would run:
              {mysureg ($y1list $x1list) ($y2list $x2list), cluster(clustvar) constraints(1 2 to n)}

              Then run the nlcom:
              nlcom: (phi(1/((_b[$y1list:lnx])+(_b[$y1list:lnx_2])
              -This would provide the scalar Phi estimate. However, it excludes (lnx)
              I hope this clarifies what I am trying to do.
              Thanks again for your time and advise in solving this issue.


              Last edited by chuck wokk; 25 May 2019, 09:46.

              Comment


              • #8
                Hi Chuck,
                your question is still confusing. you say you try to use the command "mysureg". This doesnt exist in stata, so you either wrote a program with that name, somebody else wrote it and you are using, or you download it from somewhere, and again are trying to use.
                In cases like this, is often better to take a step back. without using bootstrap, describe what commands do you want to run to get the results you want.
                Dont try to do it with a random example, but what you would actually do with your data.
                Once you get that, will be easier to provide a working example for the bootstrap procedure.
                Fernando

                Comment


                • #9
                  Hi Fernando,

                  You are absolutely correct. Someone else wrote it and I downloaded the command as it permits one to cluster errors.

                  I picked it up from another thread below:

                  "For clustering with SUR, I would suggest the Stata ado file mysureg from William Gould, Jeffrey Pitblado, and Brian Poi, which can be downloaded here:
                  http://www.stata-press.com/data/ml4.html
                  . It allows for use with svy commands, clustering and weighting."

                  I believe that could be the reason that the bootstrap command does not recognize it. Let me go ahead and work on it and will reach out once I review the code.

                  Thank you very much for the response.

                  Comment

                  Working...
                  X