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

tbats strange behaviour #87

Closed
denadai2 opened this issue Sep 18, 2014 · 13 comments
Closed

tbats strange behaviour #87

denadai2 opened this issue Sep 18, 2014 · 13 comments
Labels

Comments

@denadai2
Copy link

denadai2 commented Sep 18, 2014

I write this issue because tbats is behaving strangely and I think it's a bug.

File: https://dl.dropboxusercontent.com/u/1118905/bug.RData
Source:

library(forecast)
load("bug.RData")
y <- msts(dat.ts, seasonal.periods=c(24, (7*24)))
fit <- tbats(y)
plot(fit)

It doesn't show the slope and season. Maybe it doesn't find the seasonality, but so why doesn't it show a warning message?
screen shot 2014-09-18 at 17 46 13
It behaves normally with

y <- msts(dat.ts, seasonal.periods=c(24))

Thanks

@robjhyndman
Copy link
Owner

robjhyndman commented Sep 18, 2014

The fitted model is clearly unstable which is a problem. I'll look into why that happens.

The seasonality is not being picked up because it is not correctly specified. The graph indicates the length of a day is less than 24 observations. This is also evident in the fitted model using seasonal.periods=24, where the level has tried to pick up some of the seasonality because of the mis-specification.

@slavarazbash
Copy link

slavarazbash commented Sep 18, 2014

Hi Marco,

In the first case, it seems that the algobfinds that the best model has no
seasonal components and no trend. It tries different nested models and
picks the one with the lowest AIC. I think that it is too early to call it
a bug.

Is this hourly data? Are you trying to model weekly seasonality in the
first example? If so, then you need at least four weeks to model weekly
seasonality. How many weeks of data do you have?

Best Regards,

Slava Razbash
On 19/09/2014 1:58 am, "Marco De Nadai" notifications@github.com wrote:

I write this issue because tbats is behaving strangely and I think it's a
bug.

File: https://dl.dropboxusercontent.com/u/1118905/bug.RData
Source:

library(forecast)
load("bug.RData")
y <- msts(dat.ts, seasonal.periods=c(24, (7*24))
fit <- tbats(y)
plot(fit)

It doesn't show the slope and season. Maybe it doesn't find the
seasonality, but so why doesn't it show a warning message?
[image: screen shot 2014-09-18 at 17 46 13]
https://cloud.githubusercontent.com/assets/190799/4322742/fc62ef1e-3f4a-11e4-843f-f447ff026128.png
It behaves normally with

y <- msts(dat.ts, seasonal.periods=c(24))

Thanks


Reply to this email directly or view it on GitHub
#87.

@robjhyndman
Copy link
Owner

robjhyndman commented Sep 18, 2014

Here is the fitted model:

fit
BATS(0.369, {2,3}, -, -)

Call: tbats(y = y)

Parameters
Lambda: 0.36928
Alpha: 0.60449
AR coefficients: 1.7239 -0.83751
MA coefficients: -0.98829 0.13707 -0.14475

Seed States:
[,1]
[1,] 11.111
[2,] 0.000
[3,] 0.000
[4,] 0.000
[5,] 0.000
[6,] 0.000

Sigma: 3.4771e+52
AIC: 9188.2

Slava: What are the four zero seed states? With no seasonality, and no trend, I was expecting only one seed state here.

@slavarazbash
Copy link

slavarazbash commented Sep 18, 2014

They are the arma states.
On 19/09/2014 8:55 am, "Rob J Hyndman" notifications@github.com wrote:

Here is the fitted model:

fit
BATS(0.369, {2,3}, -, -)

Call: tbats(y = y)

Parameters
Lambda: 0.36928
Alpha: 0.60449
AR coefficients: 1.7239 -0.83751
MA coefficients: -0.98829 0.13707 -0.14475

Seed States:
[,1]
[1,] 11.111
[2,] 0.000
[3,] 0.000
[4,] 0.000
[5,] 0.000
[6,] 0.000

Sigma: 3.4771e+52
AIC: 9188.2

Slava: What are the four zero seed states? With no seasonality, and no
trend, I was expecting only one seed state here.


Reply to this email directly or view it on GitHub
#87 (comment).

@robjhyndman
Copy link
Owner

robjhyndman commented Sep 19, 2014

OK. I wonder why the level heads out of control near the end. It looks like a "divide by something close to zero" problem.

Can you see why these give different models:

fit <- tbats(y)
by <- BoxCox(y, lambda=fit$lambda)
fit2 <- tbats(by, use.box.cox=FALSE)

The latter looks well behaved but the first approach isn't finding it for some reason.

@denadai2
Copy link
Author

denadai2 commented Sep 19, 2014

@robjhyndman @slavarazbash sorry I did not specified: hourly data, so that is a timeseries with frequency=24. I know that there is a daily and weekly seasonality (more or less of course). In the case posted I have one month of data.
I'm not an expert, as you see, but I'm trying a lot these algorithms :)

@slavarazbash
Copy link

slavarazbash commented Sep 19, 2014

Marco, how manys days of data do you have?
On 19/09/2014 11:09 am, "Marco De Nadai" notifications@github.com wrote:

@robjhyndman https://github.com/robjhyndman @slavarazbash
https://github.com/slavarazbash sorry I did not specified: hourly data,
so that is a timeseries with frequency=24. I know that there is a daily and
weekly seasonality (more or less of course).
I'm not an expert, as you see, but I'm trying a lot these algorithms :)


Reply to this email directly or view it on GitHub
#87 (comment).

@denadai2
Copy link
Author

denadai2 commented Sep 19, 2014

29 days and some hours :)

(you can load the data from dropbox if you want)

@denadai2
Copy link
Author

denadai2 commented Sep 23, 2014

so is it a bug?

@slavarazbash
Copy link

slavarazbash commented Sep 23, 2014

I have not had time to look at it non-superficially. I'll get back to you.
I have been working at my day job....
On 23/09/2014 10:25 pm, "Marco De Nadai" notifications@github.com wrote:

so is it a bug?


Reply to this email directly or view it on GitHub
#87 (comment).

@denadai2
Copy link
Author

denadai2 commented Sep 23, 2014

@slavarazbash ok

@harmbuisman
Copy link

harmbuisman commented Sep 29, 2014

Dear all, not sure if it is the same issue, but I also found some cases where tbats gives unstable output. There is no seasonality in this signal.

Reproduction:

library(forecast)
train = structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3255, 1570, 7960, 8270,
5520, 3930, 5450, 4130, 890, 6119, 5240, 0, 80, 360, 280, 480,
1440, 1000, 1352, 1200, 584, 704, 800, 480, 720, 656, 696, 560,
376, 520, 760, 1360, 1448, 1048, 1520, 1240, 360, 360, 120, 1000,
360, 560, 776, 576, 560, 720, 536, 280, 1632, 2984, 520, 360,
360, 700, 319.958334, 440, 904, 1000, 1224, 888, 1248, 1080,
1136, 1191, 1240, 800, 999.5, 1199, 2423, 2584, 1959.958333,
1479, 200, 696, 760, 400, 440, 464, 368, 344, 352, 368, 2960,
3320, 64, 464, 734, 460, 80, 120), .Tsp = c(1, 162, 1), class = "ts")
plot(forecast(tbats(train)))
plot

@robjhyndman
Copy link
Owner

robjhyndman commented Apr 21, 2015

These problems have now been fixed by modifying the admissibility check to be stricter. i.e., the roots of the ARMA component and the eigenvalues of the matrix must now be further away from 1.

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

No branches or pull requests

4 participants