christophsax / tempdisagg

Methods for Temporal Disaggregation and Interpolation of Time Series
http://cran.r-project.org/web/packages/tempdisagg
36 stars 5 forks source link

Fehlermeldung bei ta() #46

Closed felicitaskemeny closed 4 years ago

felicitaskemeny commented 4 years ago

Gewisse LIK-Rubriken (monatliche Reihen) lassen sich nicht zu Quartals- oder Jahresreihen aggregieren. Scheint damit zusammenzuhängen, dass die Monatsreihe nicht am Anfang des Quartals beginnt.


> lik_100_12160 <- dput(db("lik_100_12160"))
structure(c(89.0412, 89.0412, 89.0412, 89.1338, 89.1338, 89.1338, 
89.0583, 89.0583, 89.0583, 89.3261, 89.3261, 89.3261, 89.8094, 
89.8094, 89.8094, 89.6869, 89.6869, 89.6869, 89.7391, 89.7391, 
89.7391, 90.1895, 90.1895, 90.1895, 90.0487, 90.0487, 90.0487, 
89.9066, 89.9066, 89.9066, 89.8753, 89.8753, 89.8753, 90.3668, 
90.3668, 90.3668, 90.598, 90.598, 90.598, 90.62, 90.62, 90.62, 
90.5562, 90.5562, 90.5562, 90.8328, 90.8328, 90.8328, 90.5256, 
90.5256, 90.5256, 91.0481, 91.0481, 91.0481, 91.4245, 91.4245, 
91.4245, 91.5148, 91.5148, 91.5148, 92.0093, 92.0093, 92.0093, 
91.8986, 91.8986, 91.8986, 91.6705, 91.6705, 91.6705, 91.8291, 
91.8291, 91.8291, 91.909, 91.909, 91.909, 91.9005, 91.9005, 91.9005, 
91.9144, 91.9144, 91.9144, 92.2406, 92.2406, 92.2406, 92.4083, 
92.4083, 92.4083, 92.5676, 92.5676, 92.5676, 92.7673, 92.7673, 
92.7673, 93.5604, 93.5604, 93.5604, 93.7825, 93.7825, 93.7825, 
94.3769, 94.3769, 94.3769, 94.7609, 94.7609, 94.7609, 94.2484, 
94.2484, 94.2484, 94.8251, 94.8251, 94.8251, 95.0098, 95.0098, 
95.0098, 93.1522, 93.1522, 93.1522, 94.7399, 94.7399, 94.7399, 
95.0127, 95.0127, 95.0127, 94.419, 94.419, 94.419, 94.3156, 94.3156, 
94.3156, 94.2127, 94.2127, 94.2127, 93.9422, 93.9422, 93.9422, 
93.8905, 93.8905, 93.8905, 94.7893, 94.7893, 94.7893, 94.9538, 
94.9538, 94.9538, 95.1324, 95.1324, 95.1324, 94.7099, 94.7099, 
94.7099, 94.4971, 94.4971, 94.4971, 95.0758, 95.0758, 95.0758, 
95.4537, 95.4537, 95.4537, 95.2662, 95.2662, 95.2662, 95.5745, 
95.5745, 95.5745, 95.94, 95.94, 95.94, 96.1311, 96.1311, 96.1311, 
96.4354, 96.4354, 96.4354, 96.8179, 96.8179, 96.9504, 97.061, 
98.7566, 98.6455, 98.7877, 99.0599, 97.0809, 99.3728, 99.5172, 
100.3196, 100.5313, 100.6134, 100.3244, 100.5603, 98.9194, 98.6342, 
100.3088, 100.4558, 100.0874, 100.1031, 99.9343, 100.4688, 100.6672, 
100.689, 100.3704, 100.6118, 100.6603, 100.4653, 100.6196, 100.6205, 
100.7691, 100.695, 100.6827, 100.1644, 100.9889, 100.9164, 101.1485, 
101.3798, 101.3547, 101.4076, 100.598, 100.5105, 101.4132, 101.6666, 
101.2366, 101.2058, 101.204, 101.1568, 101.0058, 101.1407, 101.1798, 
101.6042, 101.5331, 100.8343, 100.9357, 100.8347, 100.7911, 100.8726, 
100.9883, 100.7054, 99.6125, 100.1777, 100.2347, 98.3518, 99.9602, 
99.3082, 99.9318, 100.2561, 100.3935, 99.7952, 100.3885, 100.5865, 
100.3997, 100.757, 100.7264, 100.5408, 100.753, 100.0208, 100.3225, 
100.6254, 100.8714, 100.8526, 100.2161, 101.0346, 100.8942, 100.6786, 
100.2051, 100.1596, 99.5741, 99.8693, 99.7429, 99.2133, 99.7132, 
100.0888, 99.9647, 100, 99.3587, 99.3455, 99.8297, 99.9535, 99.5951, 
99.8789, 96.5434, 97.2761, 99.1497, 99.3724, 99.0011, 98.5297, 
96.7619, 97.5867, 97.8746, 98.3279, 98.7445, 97.6527, 95.2985, 
96.5136, 97.8046, 98.3276, 97.5958, 97.6009, 96.0576, 96.0169, 
97.1835, 97.255, 97.2294, 96.9342, 95.5214, 96.2469, 97.4422, 
97.6205, 97.5114, 99.0818, 96.8758, 96.9394, 98.9879, 99.1232, 
98.8458, 97.7533, 93.5417, 96.7567, 98.8927, 98.8465, 99.0665, 
97.8063, 97.1112, 97.873, 99.9719, 99.857, 99.3592, 98.8325), .Tsp = c(1993.33333333333, 
2020.41666666667, 12), class = "ts")

> q <- ta(lik_100_12160, to=4)
Error in if (start > end) stop("'start' cannot be after 'end'") : 
  argument is of length zero
In addition: Warning message:
In .cbind.ts(list(e1, e2), c(deparse(substitute(e1))[1L], deparse(substitute(e2))[1L]),  :
  non-intersecting series
christophsax commented 4 years ago

The problem arises form an interaction with tstools: https://github.com/dpkj/tstools/issues/76

This here works fine:

library(tempdisagg)
x <- ts(1:20, start = c(2000, 5), frequency = 12)
ta(x, to = 4)
#>      Qtr1 Qtr2 Qtr3 Qtr4
#> 2000             12   21
#> 2001   30   39   48   57

Created on 2020-09-15 by the reprex package (v0.3.0)