Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number of forcasted periods is incorrect for super-annual frequencies. #40

Open
christophsax opened this issue Oct 16, 2019 · 1 comment

Comments

@christophsax
Copy link
Owner

library(tempdisagg)

For usual frequencies, things work like this:

lf = ts(1:4, start = 1989, freq = 1)
hf = ts(1:16, start = 1989, freq = 4)
predict(td(formula = lf~hf, conversion = 'first'))
#>      Qtr1 Qtr2 Qtr3 Qtr4
#> 1989 1.00 1.25 1.50 1.75
#> 1990 2.00 2.25 2.50 2.75
#> 1991 3.00 3.25 3.50 3.75
#> 1992 4.00 4.25 4.50 4.75

Howeever, for super-annual frequencies, this does not work:

lf = ts(1:4, start = 1989, freq = 1/2)
hf = ts(1:8, start = 1989, freq = 1)
predict(td(formula = lf~hf, conversion = 'first'))
#> High frequency series shorter than low frequency. Discarding low frequency after 1994.
#> Error in SubRegressionBased(y_l = y_l, X = X, hf = hf, lf = lf, lf.end = lf.end, : identical(dim(C)[2], dim(X)[1]) is not TRUE

Seems to be related to the following line in td:

n.fc <- as.integer(round((X.end - end) * f)) - fr + 1L

Which is calculated as 1 for the example above but should be 0.

This probably needs a few tests for the usual frequencies, as a change to the formula is likely to break stuff.

@christophsax
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant