如何确定时间序列中的最佳频率? [英] How to identify the best frequency in a time series?

查看:194
本文介绍了如何确定时间序列中的最佳频率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有按天分组的数据库指标,我需要预测未来3个月的数据.这些数据具有季节性(我认为季节性是一周中的几天).

我想使用R的Holt Winters方法,我需要创建一个时间序列对象,该对象要求频率(我认为是7). 但是我怎么知道我确定呢?有识别最佳频率的功能吗?

我正在使用:

FID_TS <- ts(FID_DataSet$Value, frequency=7)

FID_TS_Observed <- HoltWinters(FID_TS)

如果用decompose(FID_TS)分解此数据,我将得到:

这是我的第一个预测FID_TS_Observed:

当我查看去年的历史时,它们在前三个月开始时较低,从第3个月开始增加到第11个月,然后再次下降.

也许是我的日常数据,每天有一个每周的季节性(频率= 7)和一个每月的季节性(频率= 7x30 = 210)?我需要最近365天吗?

有什么方法可以按周和按月显示频率?另一件事,我将整个去年或只是Holt-Winters方法中使用的一部分或全部改变了吗?

先谢谢您了:)

解决方案

通常,频率(或季节性,您似乎在帖子中互换使用)是由领域知识决定的.例如,如果我在餐饮业工作,并且正在分析每小时的客户数据集,我知道我将有一个24小时的频率,在午餐时间和晚餐时间会有峰值,而另一个是168小时的频率(24 * 7)因为我的客户每周都会有一个模式.

如果由于某种原因您不具备领域知识,则可以使用ACF和PACF以及傅里叶分析来找到最适合数据的频率.

有什么方法可以按周和按月显示频率?

没有Holt-Winters,没有.硬件仅包含一个季节性组成部分.对于多个季节性因素,您应该尝试使用TBATS.正如吴晓曦指出的那样,FB Prophet可以对多个季节建模,而Google的BSTS软件包也可以.

另一件事,我用了整个Holt-Winters方法的整个一年还是一部分,有什么不同吗?

是的.我想对一个季节性进行建模,那么您至少需要两倍该季节性周期才能建模(最好是更多),否则您的模型就无法知道峰值是季节性变化还是一次冲动.因此,例如,要对每周的季节性进行建模,则需要至少14天的训练数据(加上用于测试的任何数据,而对于年度的季节性,则至少需要730天的数据,等等. >

I have a database metrics grouped by day, and I need to forecast the data for the next 3 months. These data have seasonality, (I believe that the seasonality is by days of the week).

I want to use the Holt Winters method using R, I need to create a time series object, which asks for frequency, (That I think is 7). But how can I know if I'm sure? Have a function to identify the best frequency?

I'm using:

FID_TS <- ts(FID_DataSet$Value, frequency=7)

FID_TS_Observed <- HoltWinters(FID_TS)

If I decompose this data with decompose(FID_TS), I have:

And this is my first forecast FID_TS_Observed:

When I look at the history of the last year, they starts low in the first 3 months and increase from month 3 to 11, when they decrease again.

Maybe my daily data, have a daily have a weekly seasonality (frequency=7) and an monthly seasonality (frequency=7x30=210)? I need the last 365 days?

Have any way to put the frequency by day of the week and by month? Another thing, does it make any difference I take the whole last year or just a part of it to use in the Holt-Winters method?

Thanks in advance :)

解决方案

Usually, the frequency (or seasonality, you seem to be using the words interchangeably in your post) is determined by domain knowledge. For example if I am working in the restaurant business, and I am analyzing an hourly data set of customers, I know that I will have a 24 hour frequency, with spikes during lunch time and dinner time, and another 168 hour frequency (24 * 7) because there will be a weekly pattern to my customers.

If for some reason, you don't have domain knowledge, you can use the ACF and the PACF, as well as Fourrier analysis to finds the best frequencies for your data.

Have any way to put the frequency by day of the week and by month?

With Holt-Winters, no. HW takes only one seasonal component. For multiple seasonal components, you should try TBATS. As Xiaoxi Wu pointe out, FB Prophet can model multiple seasonalities, and Google's BSTS package can as well.

Another thing, does it make any difference I take the whole last year or just a part of it to use in the Holt-Winters method?

Yes it does. I you want to model a seasonality, then you need at least two times the seasonal period to be able to model it (preferably more), otherwise your model has no way of knowing whether a spike is a seasonal variation or just a one time impulse. So for example to model a weekly seasonality, you need at least 14 days of training data (plus whatever you will use for testing, and for a yearly seasonality, you will need at least 730 days of data, etc....

这篇关于如何确定时间序列中的最佳频率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆