Convert from annual to quarterly data, constrained to annual average

后端 未结 3 2148
走了就别回头了
走了就别回头了 2021-01-06 08:16

I have several variables at annual frequency in R that I would like to include in a regression analysis with other variables available at quarterly frequency. Additionally,

3条回答
  •  佛祖请我去吃肉
    2021-01-06 08:44

    A bit late here, but the tempdisagg package does what you want. It ensures that either the sum, the average, the first or the last value of the resulting high frequency series is consistent with the low frequency series.

    It also allows you to use external indicator series, e.g., by the Chow-Lin technique. If you don't have it, the Denton-Cholette method produces a better result than the method in Eviews.

    Here's your example:

    # need ts object as input
    z_a <- ts(c(100, 110, 111), start = 2000)
    
    library(tempdisagg)
    z_q <- predict(td(z_a ~ 1, method = "denton-cholette", conversion = "average"))
    
    z_q
    #           Qtr1      Qtr2      Qtr3      Qtr4
    # 2000  97.65795  98.59477 100.46841 103.27887
    # 2001 107.02614 109.71460 111.34423 111.91503
    # 2002 111.42702 111.06100 110.81699 110.69499
    
    # which has the same means as your original series:
    
    tapply(z_q, floor(time(z_q)), mean)
    # 2000 2001 2002 
    #  100  110  111 
    

提交回复
热议问题