Announcement

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

  • How to construct a 95% confidence interval for a solved regression equation?

    I have solved a regression equation in order to find a CEO's salary after ten years. The equation is as follows:


    Salary = (Coef. of _cons) + (Coef. of ceo variable) * (10 years)

    or

    Salary = 772.4263 + (11.74613)*(10) = 889.8876 or $889,887.60


    I would now like to construct a confidence interval which predicts the average CEO salary after ten years. I would also like to find the upper and lower bounds of this prediction. However, if I plug in the ceo variable and salary variable into the ". ci" command, the numbers do not make sense. How would I predict these bounds which properly match the solved ceo salary?


    Also, how would I show these boundaries graphically on a scatter plot alongside the regression line?

    Thank you.

  • #2
    Dylan:
    you can take advantage of some of the -predict- commands (see -regression postestimation- entry in Stata .pdf manual) for your forecast, as you can see in the following toy-example:
    Code:
    . use "C:\Program Files\Stata16\ado\base\a\auto.dta"
    (1978 Automobile Data)
    
    . regress price mpg
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =     20.26
           Model |   139449474         1   139449474   Prob > F        =    0.0000
        Residual |   495615923        72  6883554.48   R-squared       =    0.2196
    -------------+----------------------------------   Adj R-squared   =    0.2087
           Total |   635065396        73  8699525.97   Root MSE        =    2623.7
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             mpg |  -238.8943   53.07669    -4.50   0.000    -344.7008   -133.0879
           _cons |   11253.06   1170.813     9.61   0.000     8919.088    13587.03
    ------------------------------------------------------------------------------
    
    . predict fitted, xb
    
    . predict fitted_se_forecast, stdf
    
    . list make fitted fitted_se_forecast in 1/10
    
         +-------------------------------------+
         | make              fitted   fitted~t |
         |-------------------------------------|
      1. | AMC Concord     5997.385   2641.584 |
      2. | AMC Pacer       7191.857    2651.15 |
      3. | AMC Spirit      5997.385   2641.584 |
      4. | Buick Century   6475.174   2642.218 |
      5. | Buick Electra   7669.646   2662.385 |
         |-------------------------------------|
      6. | Buick LeSabre   6952.962   2647.112 |
      7. | Buick Opel      5041.808   2653.088 |
      8. | Buick Regal     6475.174   2642.218 |
      9. | Buick Riviera   7430.751   2656.243 |
     10. | Buick Skylark   6714.068   2644.134 |
         +-------------------------------------+
    
    .
    Then you can calculate the 95% CI assuming normality.
    Otherwise, you can compute a bootstrapped 95% CI around the -fitted- values (see -bootstrap- entry in Stata .pdf manual).
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dylan:
      you can take advantage of some of the -predict- commands (see -regression postestimation- entry in Stata .pdf manual) for your forecast, as you can see in the following toy-example:
      Code:
      . use "C:\Program Files\Stata16\ado\base\a\auto.dta"
      (1978 Automobile Data)
      
      . regress price mpg
      
            Source |       SS           df       MS      Number of obs   =        74
      -------------+----------------------------------   F(1, 72)        =     20.26
             Model |   139449474         1   139449474   Prob > F        =    0.0000
          Residual |   495615923        72  6883554.48   R-squared       =    0.2196
      -------------+----------------------------------   Adj R-squared   =    0.2087
             Total |   635065396        73  8699525.97   Root MSE        =    2623.7
      
      ------------------------------------------------------------------------------
             price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
               mpg |  -238.8943   53.07669    -4.50   0.000    -344.7008   -133.0879
             _cons |   11253.06   1170.813     9.61   0.000     8919.088    13587.03
      ------------------------------------------------------------------------------
      
      . predict fitted, xb
      
      . predict fitted_se_forecast, stdf
      
      . list make fitted fitted_se_forecast in 1/10
      
           +-------------------------------------+
           | make              fitted   fitted~t |
           |-------------------------------------|
        1. | AMC Concord     5997.385   2641.584 |
        2. | AMC Pacer       7191.857    2651.15 |
        3. | AMC Spirit      5997.385   2641.584 |
        4. | Buick Century   6475.174   2642.218 |
        5. | Buick Electra   7669.646   2662.385 |
           |-------------------------------------|
        6. | Buick LeSabre   6952.962   2647.112 |
        7. | Buick Opel      5041.808   2653.088 |
        8. | Buick Regal     6475.174   2642.218 |
        9. | Buick Riviera   7430.751   2656.243 |
       10. | Buick Skylark   6714.068   2644.134 |
           +-------------------------------------+
      
      .
      Then you can calculate the 95% CI assuming normality.
      Otherwise, you can compute a bootstrapped 95% CI around the -fitted- values (see -bootstrap- entry in Stata .pdf manual).
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Thanks!

        Comment


        • #5
          So I tried the first option using the fitted value, and once I use the ci means command for the fitted value, the confidence interval is the same as the means. Why is this? What did I do wrong?

          Comment


          • #6
            Dylan:
            as per FAQ, could you please share what you typed and what Stata gave you back with both the approaches that you followed? Thanks.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment

            Working...
            X