Announcement

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

  • Interpolation: Denton method

    Hello again Statalists,

    I am trying to increase the frequency of data by using the Denton interpolation method. Specifically, starting from annual flow series I want to go to quarterly. To do so, I can rely on some quarterly indicators. However, when I perform the denton interpolation, I get same dynamics but with different numbers. See more details below:

    This is the code I use. The quarterly indicator is econindex and is taken from indicator_qrt.dta
    Code:
    denton rgdp using qrtdata.dta, interp(econindex) from(indicator_qrt.dta) generate(qinterp)
    The data stored is the annual, specifically the data I want to transform at quarterly frequency is rgdp, below the data:
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int year str20 state double rgdp
    1997 "Alabama" 144501.2
    1998 "Alabama" 149568.2
    1999 "Alabama" 154900.2
    2000 "Alabama" 157221.3
    2001 "Alabama" 156853.2
    2002 "Alabama" 160422.4
    2003 "Alabama" 165134.7
    2004 "Alabama"   176625
    2005 "Alabama" 184369.5
    2006 "Alabama" 187270.8
    2007 "Alabama" 189002.5
    2008 "Alabama" 186946.7
    2009 "Alabama" 180707.2
    2010 "Alabama" 184702.4
    2011 "Alabama" 187605.8
    2012 "Alabama" 189245.5
    2013 "Alabama" 191369.8
    2014 "Alabama" 189886.3
    2015 "Alabama" 191335.2
    2016 "Alabama" 194283.8
    2017 "Alabama" 197566.6
    2018 "Alabama" 200800.9
    2019 "Alabama" 203383.9
    end
    format %ty year
    The following is the indicator_qrt.dta where I get the indicator econindex, below the data:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int quarter double econindex float qdate
    13515  1.3443098567129492 148
    13605  1.6221526356597082 149
    13696  1.5459310238646764 150
    13788  1.7053243914745135 151
    13880   2.036024563725839 152
    13970  2.2108922624535037 153
    14061  2.0472732017399506 154
    14153   2.024462604279399 155
    14245  1.7101240819826684 156
    14335   1.269611297999968 157
    14426  1.1223472020328258 158
    14518    .872236422553766 159
    14610   .6966683477984483 160
    14701   .4738476150756166 161
    14792 -.14132052544288098 162
    14884  -.6123124751202192 163
    14976  -.8742018950061025 164
    15066  -.9725743065789229 165
    15157  -.6455640560875722 166
    15249  -.7445041112741398 167
    15341 -1.0595888097239954 168
    15431  -.5525523805471345 169
    15522 -.22820462516489776 170
    15614 -.24426947467756935 171
    15706 -.08049462864421393 172
    15796 -.45722922726737064 173
    15887  -.5176480045204962 174
    15979 .020762180024036958 175
    16071  .48967884927977173 176
    16162   .8029412900826702 177
    16253  1.0149211258513964 178
    16345   1.314066740922601 179
    16437  1.4484633540371588 180
    16527  1.1932642739333674 181
    16618   .9267122372885795 182
    16710   .8516637233003508 183
    16802  1.5493366773383244 184
    16892  1.7389709506898332 185
    16983   1.720607015842189 186
    17075  1.2068338962580052 187
    17167  1.0097905582536961 188
    17257    .716972567737948 189
    17348   .3553684210831131 190
    17440  .10974428261277311 191
    17532   -.569769434936897 192
    17623  -1.252007903302237 193
    17714 -2.0167004453200046 194
    17806   -3.08978556520989 195
    17898  -4.707422127930271 196
    17988  -5.258871461681494 197
    18079  -4.814311081377643 198
    18171  -4.610123505264475 199
    18263  -3.791900627268809 200
    18353  -2.508176233648013 201
    18444 -1.8964691686106419 202
    18536 -1.2505521624048843 203
    18628  -.6222996896558853 204
    18718  -1.517218614511421 205
    18809 -1.9921556893029064 206
    18901 -2.0112482752814373 207
    18993 -1.0625924469824255 208
    19084  -.3506938773967461 209
    19175  -.6341965351662199 210
    19267  -.5778331094202209 211
    19359  -.8454898858318749 212
    19449  -.6662324782479689 213
    19540  -.8817312797249944 214
    19632  -.7190611410718056 215
    19724 -1.1013823652338108 216
    19814   -.665173140330442 217
    19905   .2504158309123477 218
    19997    .572004033654525 219
    20089   1.093828109265804 220
    20179   .7693644775315049 221
    20270   .6443859800755831 222
    20362   .3475716158017814 223
    20454   .2994069198922408 224
    20545  .35132603038922444 225
    20636  .31068582699715347 226
    20728   .3894113691311952 227
    20820  .43666655212711575 228
    20910   .8175278684244197 229
    21001   .9702331113566306 230
    21093  1.3619685918244906 231
    21185   1.471135285445717 232
    21275   1.401259020463347 233
    21366   1.377192186193806 234
    21458   1.198263344221647 235
    21550  1.4014963747075664 236
    21640  1.6153160721075834 237
    21731  1.6852505100610722 238
    21823  1.4672342750337042 239
    end
    format %td quarter
    format %tq qdate
    Finally, this is the output of the denton method. The dynamics are the same (if plotted on different scales) but with different numbers.. and this is what I need help for. See below:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double rgdp float qdate double qinterp
           . 148  35887.34936331243
           . 149  35989.42714043947
           . 150  36171.05848945483
    144501.2 151 36453.368131793264
           . 152 36834.257012176204
           . 153 37210.755746504954
           . 154  37575.87976040138
    149568.2 155  37947.31060591746
           . 156 38308.756659581966
           . 157  38614.89662952376
           . 158  38881.90154600916
    154900.2 159 39094.648289885125
           . 160 39260.041626884864
           . 161  39347.58042462367
           . 162  39343.81019733248
    157221.3 163 39269.864626158975
           . 164 39128.391295910405
           . 165  39105.01261284258
           . 166  39209.89584779844
    156853.2 167  39409.90336844859
           . 168  39713.02899536933
           . 169  40007.82265653436
           . 170  40254.63039741177
    160422.4 171  40446.92420068456
           . 172  40605.52692130695
           . 173  40925.18814312442
           . 174 41440.432848862576
    165134.7 175 42163.555211706036
           . 176  43067.58135241765
           . 177  43863.07668552507
           . 178  44551.95772346563
      176625 179 45142.384238591665
           . 180  45622.96759293956
           . 181   45995.2013543589
           . 182  46276.12773166911
    184369.5 183  46475.20332103243
           . 184 46619.483642388135
           . 185 46752.316238448635
           . 186  46887.49301388982
    187270.8 187 47011.503980273446
           . 188  47162.16987554296
           . 189   47256.4233916958
           . 190 47295.563352984216
    189002.5 191  47288.34337977707
           . 192  47208.97794341411
           . 193  46990.63104022837
           . 194  46629.97588379118
    186946.7 195  46117.11825756635
           . 196 45442.352559072664
           . 197 45073.717650470346
           . 198  45006.39193161969
    180707.2 199 45184.740983837284
           . 200  45647.79702250493
           . 201  46061.91431070132
           . 202  46374.64871631444
    184702.4 203  46618.04620047936
           . 204 46789.529135328885
           . 205  46866.52304535126
           . 206 46939.485077062265
    187605.8 207 47010.259617257616
           . 208  47102.95757368569
           . 209  47231.41079653271
           . 210 47359.920776242136
    189245.5 211 47551.210853539465
           . 212 47773.905884023996
           . 213  47902.73840535446
           . 214  47897.64847003089
    191369.8 215 47795.504115590695
           . 216 47552.389933622115
           . 217  47434.33434220952
           . 218  47425.15210054358
    189886.3 219  47474.42049862475
           . 220   47619.7724043498
           . 221  47745.52396996798
           . 222  47901.09244160464
    191335.2 223 48068.814309077556
           . 224  48268.75638660906
           . 225  48472.29163873054
           . 226  48670.15580196129
    194283.8 227  48872.59304769914
           . 228   49072.3137669532
           . 229 49288.616096236285
           . 230  49494.06527893534
    197566.6 231   49711.5986078751
           . 232  49915.49584014635
           . 233  50107.49812891704
           . 234  50298.73725139218
    200800.9 235  50479.17502954443
           . 236 50675.760232610846
           . 237 50826.354219601395
           . 238   50923.1098680559
    203383.9 239  50958.68192973182
    end
    format %tq qdate

    I thank you in advance for any help and/or suggestion or alternatives that allow to use monthly/quarterly indicators to construct the quarterly rgdp from the original annual data.

    Best,
    Alessandro

  • #2
    Results are similar when using personal income instead of a growth rate of an economic index (econindex).

    Comment


    • #3
      Sorry, Alessandro Franconi, what exactly is the problem you are facing?

      Joao

      Comment


      • #4
        This is the output of the denton method using real gdp (annual) and personal income as the indicator (quarterly):

        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input double rgdp float qdate double qinterp
               . 148  35821.30525955906
               . 149 35948.301104109916
               . 150  36234.80719979105
        144501.2 151  36496.78956153998
               . 152  37070.75862293028
               . 153  37175.06287340251
               . 154 37432.897166539435
        149568.2 155  37889.48446212777
               . 156 38367.871314955315
               . 157  38495.10042832705
               . 158  38903.36843870938
        154900.2 159  39133.86294300826
               . 160  39183.42046233451
               . 161  39439.74694721068
               . 162  39209.85887823768
        157221.3 163  39388.27058721713
               . 164  39268.76429363988
               . 165 39350.410864146674
               . 166  39121.24808684294
        156853.2 167  39112.77988037051
               . 168  39464.64520793533
               . 169  40066.64992386656
               . 170  40325.22030443536
        160422.4 171  40565.89081376275
               . 172  40798.28111214219
               . 173  40889.74696800866
               . 174  41381.89330583454
        165134.7 175  42064.78173901461
               . 176  42955.20281893299
               . 177  43836.71862120998
               . 178 44529.615402653864
          176625 179  45303.46315720315
               . 180  45565.79775572238
               . 181 46076.216640310304
               . 182  46178.36742288897
        184369.5 183  46549.11818107833
               . 184  46853.49098416222
               . 185  46948.42055912647
               . 186   46752.3622282252
        187270.8 187  46716.52310348612
               . 188 47264.237929566414
               . 189  47446.43789488275
               . 190  47209.72935944304
        189002.5 191  47082.09481610779
               . 192 46660.305418105665
               . 193  48180.70444962387
               . 194  46384.73488499853
        186946.7 195  45720.95837227193
               . 196  45002.33308741532
               . 197  45487.44160472312
               . 198  45118.40632957469
        180707.2 199  45099.02210328688
               . 200 45522.362669205235
               . 201  46059.03827071075
               . 202  46595.87950364324
        184702.4 203 46525.125806440774
               . 204  47023.23837925178
               . 205  46857.59249442395
               . 206  46933.97370783214
        187605.8 207  46790.99229349215
               . 208  47046.43106239024
               . 209  47299.08719749356
               . 210 46831.179329906554
        189245.5 211  48068.80241020964
               . 212   47794.6425817464
               . 213  48012.54012827943
               . 214  48102.73683873429
        191369.8 215  47459.87732623988
               . 216 47270.651463827475
               . 217   47455.0699491121
               . 218  47535.58158905365
        189886.3 219  47624.99387300677
               . 220  47707.05731324208
               . 221  47733.70743355781
               . 222   47939.6497148888
        191335.2 223   47954.7886633113
               . 224 48293.357976707695
               . 225  48493.83848551848
               . 226  48702.08490574772
        194283.8 227   48794.5155070261
               . 228 49087.203960194915
               . 229  49261.61512483612
               . 230  49459.13079828372
        197566.6 231  49758.64386668525
               . 232  50017.92575947452
               . 233  50116.87688638831
               . 234  50281.90036446839
        200800.9 235 50384.203239668765
               . 236  50684.07280644859
               . 237 50726.732436286184
               . 238  50823.16142453758
        203383.9 239  51149.93958272765
        end
        format %tq qdate
        If you notice the numbers of the original annual series do not correspond to the interpolated quarterly series. This is the problem.

        Comment


        • #5
          My bad, problem solved.

          Comment


          • #6
            Good!

            Comment


            • #7
              Alessandro Franconi out of curiosity. You are trying to interpolate annual rgdp to get quarterly real GDP for US States. If i understood correctly, why don't you use directly the available data?

              Comment


              • #8
                Dario Maimone Ansaldo Patti Simply because there's no US state-level quarterly GDP data before 2005.

                Comment


                • #9
                  Joao Santos Silva In that regard, the official US regional data source (BEA) has quarterly GDP data starting from 2005Q1, and I want to interpolate annual GDP starting in 1997 and then, from 2005Q1, rely on the official quarterly series. However, I notice that the Denton Method (see previous posts) gives me the quarterly GDP that if summed up each quarter (Q1-2-3-4) I get the annual figure. However, I would like to retrieve a cumulated interpolated series as it would be in line with the official data source.

                  Example: from the latest "dataex" and the last 5 observations:

                  Annual 2018 GDP 200800.9
                  Q1 2019 50384.203
                  Q2 2019 50684.072
                  Q3 2019 50726.732
                  Q4 2019 50823.161
                  Annual 2019 GDP 203383.9

                  I want something that goes like this:
                  Q4 2018 200800.9
                  Q1 2019 200810.9
                  Q2 2019 201620.9
                  Q3 2019 202230.9
                  Q4 2019 203383.9

                  Comment


                  • #10
                    Hi Alessandro Franconi could you give me a further explanation on how to use denton? i try to type your command but it keeps giving me an error message. before the code
                    denton rgdp using qrtdata.dta, interp(econindex) from(indicator_qrt.dta) generate(qinterp)
                    which dataset that i should to mention? annual or quarter?


                    after i mention annual dta,
                    denton expenditureusdpakistan using expenditure_new.dta, interp(consolidatedgovtcgexpenditureytd) from(expenditure_interpolate.dta) generate(qexpenditure)

                    it also giving me error message
                    consolidatedgovtcgexpenditureytd must be available for entire selected sample.
                    r(198);
                    Last edited by fauziah olive; 09 Jul 2022, 01:41.

                    Comment

                    Working...
                    X