Announcement

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

  • interpolate monthly data from quarterly

    Hi,
    I have time series data. Quarterly real GDP. I want to interpolate monthly data from the quarterly data. My data is already sorted in quarterly. I understand I can use ipolate to generate this. But I'm not sure how to do this. How do I assign each quarter to the corresponding month? How do I then interpolate linearly?
    Please help me.
    Thanks

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double RGDP float quarters
    1.967413e+13 207
    1.804428e+13 208
    1.792831e+13 209
    1.890856e+13 210
    2.100401e+13 211
    1.869884e+13 212
    1.898774e+13 213
    1.967019e+13 214
    2.110525e+13 215
    1.893856e+13 216
     1.94016e+13 217
     2.06766e+13 218
    2.333754e+13 219
    2.879804e+13 220
    2.723715e+13 221
    2.969374e+13 222
    2.994094e+13 223
    3.074136e+13 224
    2.842663e+13 225
    3.056173e+13 226
    3.178569e+13 227
     3.29908e+13 228
    2.966174e+13 229
     3.23917e+13 230
    3.432189e+13 231
    3.421635e+13 232
    3.121491e+13 233
    3.381562e+13 234
    3.310769e+13 235
    3.416841e+13 236
    3.066814e+13 237
    3.421977e+13 238
    3.300644e+13 239
     3.38609e+13 240
    2.612069e+13 241
    3.471957e+13 242
    3.277599e+13 243
    3.519921e+13 244
    3.038855e+13 245
     3.26951e+13 246
    3.343517e+13 247
    3.463101e+13 248
    end
    format %tq quarters

  • #2
    You could use ipolate. It seems simpler just to map each quarterly value to the three months to which it applies. Otherwise you could map quarterly values to months 2 5 8 11 and then interpolate, but the extra detail is spurious.

    GDP reported to 7 significant figures is upstream of you, but astonishing any way. They got the measurements right on all the shadowy parts of the economy?

    Comment


    • #3
      Originally posted by Nick Cox View Post
      You could use ipolate. It seems simpler just to map each quarterly value to the three months to which it applies. Otherwise you could map quarterly values to months 2 5 8 11 and then interpolate, but the extra detail is spurious.

      GDP reported to 7 significant figures is upstream of you, but astonishing any way. They got the measurements right on all the shadowy parts of the economy?
      Hi,
      thank you for the reply.
      Reported in local currency. Therefore I think figures should be correct. Can you please tell me which commands I should use to do this
      Otherwise you could map quarterly values to months 2 5 8 11 and then interpolate, but the extra detail is spurious.
      Thank you very much for your reply

      Comment


      • #4
        Here is a sketch, which follows from standard date-time functions:
        Code:
           
        
        gen mdate = mofd(dofq(quarters)) + 1  
        
        format %tm mdate  
        
        tsset mdate
        
        tsfill  
        
        gen work = log10(RGDP)
        
        ipolate work mdate, gen(work2)  
        
        list
        I add the refinement that interpolating in log GDP may make a little more sense than using the raw data. Other way round, there is a question of whether your data are seasonally adjusted and if not whether interpolation should pay attention to seasonality.
        Last edited by Nick Cox; 29 Jul 2022, 08:38.

        Comment


        • #5
          thank you very much

          Comment

          Working...
          X