Announcement

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

  • Post estimation prediction without using some of the coefficients

    My problem is how to make a post regression prediction by not using all the coefficients obtained in the regression. I would like to predict the outcome using only the year and age dummies. I solved the problem in a cumbersome way. I am wondering whether there is a more suitable command for that, as it would facilitate my calculations.
    Code:
    qui reg wage dum1-dum26 i.year i.age, r
    I replace all the values of the coefficients dum1-dum26 with 0's. The command 'predict' delivers me the prediction using only the age and year dummies.

    Code:
    forv i = 1(1)26 {
         replace dum`i'=0 if dum`i'==1
    }
    predict yhat, xb

  • #2
    I think that is the simplest way to accomplish it. I can think of at least one other approach, but it is more complicated.

    Comment


    • #3
      Ok, thanks a lot Clyde!

      Comment


      • #4
        If you don't want to change your data, you could also just calculate the predicted value with a generate statement. After any command, issue command,coefl and Stata will tell you how to access the specific parameters.

        Comment

        Working...
        X