Announcement

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

  • How to generate a price index using the output of a regression (real estate)?

    Hi all,

    I would like to generate a price index to determine price changes between house prices in the winter and summer time.
    My mentor gave me this explanation: "After performing regression, you can generate a price index by taking the exponential transformation of the estimated annual coefficients and multiplying that by 100."
    Attached is the output table after I performed regression.

    Can you explain what the next commands in Stata should be in order to generate this price index?


    Thanks!!

  • #2
    There was no attachment with your post.

    But attachments are not the best way to show information here anyway. Copy your regression output table directly from Stata's Results window or your log file directly into the clipboard, and then paste them here into the forum editor. Then surround them with code delimiters.

    More generally, please read the Forum FAQ, with special attention to #12, to learn the best ways to show example data, Stata code, and Stata output on the Forum. For additional help with -dataex- or code delimiters you can also watch David Benson's video at https://youtu.be/bXfaRCAOPbI.

    Comment


    • #3
      I apologize, here is the output table after regression:



      Source | SS df MS Number of obs = 30,529
      -------------+---------------------------------- F(12, 30516) = 39.64
      Model | 703.67805 12 58.6398375 Prob > F = 0.0000
      Residual | 45138.6549 30,516 1.47917993 R-squared = 0.0153
      -------------+---------------------------------- Adj R-squared = 0.0150
      Total | 45842.3329 30,528 1.50164875 Root MSE = 1.2162

      ------------------------------------------------------------------------------
      loglprice | Coef. Std. Err. t P>|t| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      hhmove |
      2000 | .0804702 .0420228 1.91 0.056 -.0018963 .1628367
      2001 | .0983964 .0361963 2.72 0.007 .0274502 .1693427
      2002 | .2763399 .0397299 6.96 0.000 .1984676 .3542122
      2003 | .3026023 .0369971 8.18 0.000 .2300864 .3751182
      2004 | .3692127 .0396259 9.32 0.000 .2915444 .446881
      2005 | .5205648 .0380497 13.68 0.000 .4459857 .5951438
      2006 | .4867876 .0427462 11.39 0.000 .4030033 .5705718
      2007 | .472207 .0397587 11.88 0.000 .3942783 .5501357
      2008 | .3988017 .0446115 8.94 0.000 .3113613 .4862422
      2009 | .4274315 .0348734 12.26 0.000 .3590782 .4957848
      2010 | .4154832 .0363104 11.44 0.000 .3443133 .4866531
      2011 | .3782519 .0355196 10.65 0.000 .3086319 .4478719
      |
      _cons | 11.49673 .0287947 399.27 0.000 11.44029 11.55317
      ------------------------------------------------------------------------------

      The following code is used to obtain the table above:

      Code:
       reg loglprice i.hhmove

      Comment


      • #4
        Running this code
        Code:
        levelsof hhmove if e(sample), local(years)
        
        gen index = .
        foreach y of local years {
            replace index = exp(_b[`y'.hhmove]) if hhmove == `y'
        }
        immediately after the regression should do it.

        Comment


        • #5
          Hi Clyde,

          Thanks, that worked well.
          I just added *100 to multiply the outcomes by 100 as my mentor has instructed.

          Can you also help me to generate a graph with the index and the variable 'yearquarter'?
          Something similar to the attached graph (but disregard the inflation).

          What should the code look like?




          Attached Files

          Comment


          • #6
            The basic code will be
            Code:
            graph twoway line index hhmove, sort
            You may want to customize the appearance of the graph using the various options available with -graph twoway-. Since you are new to Stata, I suggest you sit down with the PDF manual that comes installed with Stata and read the chapter on -graph twoway- to familiarize yourself with the possibilities. Select PDF documentation from the Help dropdown menu. From the contents page that opens select Graphics. I recommend you read the graph intro section first, and then read -graph twoway line-.

            Comment

            Working...
            X