Announcement

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

  • Estimating Okun's Law using data from Economic Report of the President 2020

    Hi,

    I am a beginner in stata, trying to estimate Okun's law using data from Economic Report of the President for years between 1959-2019. My variables are pcrgdp (percentage change in real GDP), unem (civilian unemployment rate), cunem (unem – unem[n-1]). I am referring to the paper “Okun’s Law: Fit at Fifty?” (Ball et al., 2013). Link to the paper-https://www.imf.org/en/Publications/...it-at-50-40236. In this paper, they use the following equations-
    1. Ut – Ut* = β (Yt – Yt*) + εt, β < 0,
    Where, Yt is the log of output, Ut is the unemployment rate, and *indicates a long-run level and β = γδ and εt = μt + δ ηt . Equation 1 is derived from-

    Et – Et* = γ (Yt – Yt*) + ηt, γ > 0;
    Ut – Ut* = δ (Et – Et*) + μt, δ < 0;
    1. ΔUt = α + β ΔYt + ωt,
    Where Δ is the change from the previous period. In this case, differencing the levels equation (1) yields equation (2) with α= –β ΔY*, where ΔY* is the constant growth rate of potential and ωt = Δ εt

    I wanted to confirm if the following stata command is equivalent to equation 1?

    regress cunem lnpcrgdp

    I also tried using an HP filter as used in the paper with smoothing parameters of λ= 100 and λ = 1,000, however, the command for pcrgdp did not provide any results.

    tsfilter hp pcrgdp_hp = pcrgdp

    Can someone confirm if the stata commands for equation 1 are correct? Furthermore, how should I estimate equation 2? Thanks for considering this!

  • #2
    Apologies, equation 2 -

    2. ΔUt = α + β ΔYt + ωt

    Comment


    • #3
      I think it's best you use time-series operators. You can read about them here.

      I also tried using an HP filter as used in the paper with smoothing parameters of λ= 100 and λ = 1,000, however, the command for pcrgdp did not provide any results.
      You'll need to specify the smoothing parameter using the smooth(#) option and you'll want to generate the trend component -- see the help file for tsfilter. hp. So something like


      Code:
      tsfilter hp cyc_gdp = gdp, smooth(100) trend(tr_gdp)
      As for equation 2, something like this is what's being done in table 3 equation 3 of the paper you referenced (note that the sample time frame isn't the same).

      Code:
      clear 
      tempfile temp
      
      * unemployment rate 
      local v = "UNRATE"
      import delimited using "https://fred.stlouisfed.org/series/`v'/downloaddata/`v'.csv", clear
      
      gen quarter = qofd(date(date, "YMD"))
      collapse (mean) value , by(quarter)
      ren value un 
      save `temp'
      
      * real gdp 
      local v = "GDPC1"
      import delimited using "https://fred.stlouisfed.org/series/`v'/downloaddata/`v'.csv", clear
      
      gen quarter = qofd(date(date, "YMD"))
      ren value gdp 
      gen gr_gdp = 100*(gdp/gdp[_n-1] - 1)
      
      merge 1:1 quarter using `temp', keep(match) nogen
      
      
      format quarter %tq
      tsset quarter, quarterly 
      
      reg D.un gr_gdp
      
      
            Source |       SS           df       MS      Number of obs   =       288
      -------------+----------------------------------   F(1, 286)       =    243.02
             Model |  19.1718857         1  19.1718857   Prob > F        =    0.0000
          Residual |  22.5625276       286  .078889956   R-squared       =    0.4594
      -------------+----------------------------------   Adj R-squared   =    0.4575
             Total |  41.7344132       287  .145416074   Root MSE        =    .28087
      
      ------------------------------------------------------------------------------
              D.un |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
            gr_gdp |  -.2743288   .0175975   -15.59   0.000    -.3089658   -.2396919
             _cons |   .2127309   .0214367     9.92   0.000     .1705372    .2549246
      ------------------------------------------------------------------------------
      Hope this helps.

      Comment


      • #4
        Hi Justin,

        Thanks so much for sharing this!

        I tried to use time series filters and the code you specified for the dataset extracted from Economic Report of President 2020. However, I get the following output-

        Code:
        . tsset pcrgdp
        time variable must contain only integer values
        r(451);

        . tsreport pcrgdp

        Gap summary report

        -Number of--
        Variable Start End Obs. Gaps

        pcrgdp 1959 2019 59 1


        . tsfilter hp cyc_pcrgdp = pcrgdp, smooth(100) trend(tr_pcrgdp)

        Number of gaps in sample: 1
        sample may not contain gaps
        r(498);

        I am not sure as to why it is displaying this output for pcrgdp. Do I need to transform pcrgdp in some way?

        Comment


        • #5
          tsset needs a time variable, not a response or outcome -- or otherwise a panel identifier and a time variable. See the help.

          Declare data to be time series

          tsset timevar [, options]

          tsset panelvar timevar [, options]

          In #1 you stated (edited slightly)

          My variables are pcrgdp (percentage change in real GDP), unem (civilian unemployment rate), cunem (unem – unem[n-1])
          but for this to make sense you should have a time variable too, which may be called something like year.

          So, it's a mystery how you got past that first problem, as tsfilter won't run at all without a successful tsset.

          Comment


          • #6
            Hi Nick,

            Thanks for your help.

            Apologies, I do have a year variable. year (1959-2019). After setting, tsset year, the filters worked.


            . tsset year
            time variable: year, 1959 to 2019
            delta: 1 unit

            . drop tr_pcrgdp

            . drop cyc_pcrgdp

            . tsfilter hp cyc_pcrgdp = pcrgdp, smooth(100) trend(tr_pcrgdp)

            . tsfilter hp cyc_cunem = cunem, smooth(100) trend(tr_cunem)

            However, when I tried using the code tsset timevar [, options], I get the following results-

            . tsset year [, options]
            weights not allowed


            Comment


            • #7
              You are misunderstanding the nature of syntax diagrams. See e.g.

              Code:
              help language
              for more.

              Comment

              Working...
              X