Announcement

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

  • Changing from Inflation % from previous year to Change to Inflation Rate

    Hi,

    I managed to gather data for inflation from the IMF but its measure is (Prices, Consumer Price Index, All Items, Corresponding period, previous year, percent).

    However, I'm only interested to get the inflation rate for quarter given that my data is quarterly data. To my understanding, I would think that the variable I gathered is in first difference.

    This is my variable information
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double inf
     7.74278215223094
     10.2464332036316
      12.291933418694
     13.1147540983606
     14.7381242387332
                   14
     13.5689851767389
     12.3745819397994
     11.8895966029724
     11.0423116615067
     10.8433734939759
     11.6071428571428
     9.77229601518024
      9.1078066914498
     7.78985507246374
     7.28888888888891
     6.30942091616251
     6.47359454855195
     6.13445378151261
     5.96520298260146
     5.69105691056911
     5.75999999999999
     5.77988915281077
     5.62939796716187
     5.76923076923076
     6.05143721633889
     8.00898203592812
     8.80829015544041
     9.96363636363637
     9.70042796005709
     7.90020790020794
     7.41496598639454
     7.07671957671957
     7.02210663198959
     6.61528580603723
     6.01646611779607
     4.69425571340333
     4.67800729040098
     4.51807228915663
     4.30107526881723
     4.36578171091446
     3.83052814857803
     3.80403458213255
       4.524627720504
     3.90050876201245
     3.80100614868644
     3.49805663520268
     2.57534246575342
     2.33949945593033
      2.4232633279483
     2.30686695278971
     2.24358974358973
     2.60499734183944
     2.41850683491062
     2.14997378080752
     1.98537095088822
      1.2435233160622
     .975359342915802
     1.54004106776183
     1.74180327868853
     2.66120777891503
     2.69445856634468
      2.3255813953488
     2.16515609264855
     .897308075772663
     .990099009900991
     1.38339920948619
     1.77427304090683
     3.06324110671939
     2.69607843137256
     2.29044834307992
     2.22760290556901
     2.15723873441995
      2.2434367541766
     2.28680323963794
     2.32117479867363
     2.25246363209761
     2.47432306255837
     2.04937121564973
     2.68518518518515
     2.89123451124368
     2.91571753986331
     3.42309447740759
     3.11091073038775
     3.52363960749332
     3.93979637007527
      2.5595763459841
      2.0113686051596
      1.0340370529944
     .468483816013621
     1.41996557659209
     2.22888984140592
     4.60554371002131
     2.24671470962272
     1.90920661858297
     1.21593291404613
    -1.42682429677945
     .829187396351576
     1.20732722731057
     1.24275062137531
    end
    1. Is there a code to get the inflation rate for the quarter for the information I've got?
    2. Given that this is the first difference of the change in inflation, how do I code such that Stata treats this as a first difference operator? (i.e D.inf)

    Thank you.




  • #2
    I managed to gather data for inflation from the IMF but its measure is (Prices, Consumer Price Index, All Items, Corresponding period, previous year, percent).

    However, I'm only interested to get the inflation rate for quarter given that my data is quarterly data. To my understanding, I would think that the variable I gathered is in first difference.
    The inflation rate is the year-over-year change in an underlying price index. So you'll want the change corresponding to the previous year. If you want a quarterly inflation rate, you'll need to make CPI quarterly and then calculate the year-over-year growth. I assume you want inflation for the United States provided from the Bureau of Labor Statistics. Please reference the code below. This will pull directly from the St. Louis Fed's Federal Reserve Economic Data website. If you're not using a Mac, then you can download the data here and insheet the data and run the code. Hope this helps.

    Code:
    local series = "CPIAUCSL" // Consumer Price Index for All Urban Consumers: All Items 
    !curl -L https://fred.stlouisfed.org/series/`series'/downloaddata/`series'.csv> '`series'.csv'
    insheet using "`series'.csv", names comma clear
    erase "`series'.csv"
    
    gen  quarter = qofd(date(date), "YMD") // CPI is a monthly figure 
    format quarter %tq!Qq-YY
    gen count = 1 
    
    collapse (mean) value (sum) count , by (quarter) // Need to collapse monthly to quarterly 
    drop if count != 3 // Drop incomplete quarters 
    drop count 
    
    
    gen inf_rate = round(100*(value/value[_n-4]-1), .1) 
    drop in 1/4 // Lost observations from YoY 
    
    tsset quarter, quarterly 
    tsline inf_rate

    Comment


    • #3
      Thank you, I understand that. However, I am gathering inflation data from 1980Q1 to 2016Q4 for Norway. As I could not find data on the quarterly inflation rate but rather managed to get the year-over-year change in the inflation rate. Given my data, how do I transform this information to get quarterly inflation rate if it is possible that is?

      Thank you.

      Comment


      • #4
        The year-over-year change is the inflation rate. If your data is already quarterly, then no transformation is needed.

        Comment

        Working...
        X