TBATS 的时间序列预测/预测失败,“tau + 1 + adj.beta + object$p"错误 [英] Time series prediction / forecast with TBATS failing with 'Error in tau + 1 + adj.beta + object$p'

查看:40
本文介绍了TBATS 的时间序列预测/预测失败,“tau + 1 + adj.beta + object$p"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对过去约 500 个值进行简单的时间预测.我加载 CSV 并创建季节性周期.然后我在上面安装了一个 TBATs 模型.但是,预测失败并出现以下错误:

I am doing a simple time prediction over ~500 values from the past. I load the CSV and create seasonal periods. Then I fit a TBATs model on it. However, forecast fails with the following error:

tau + 1 + adj.beta + object$p 中的错误:二元运算符的非数字参数

以下是 CSV 文件中的值:

Here are the values in the CSV file:

bps
721568138
913459160
859189590
868664078
1586563935
1650241025
1763780678
1835193425
1957420275
1667829639
3147138480
4833943170
5127746998
5230523882
5334994914
5089738945
4231188342
4531777103
5572563927
5583863417
5822395854
5796719460
5238290037
4677118239
4959055246
5641424025
5947221301
5764194468
5604617868
5258374844
4673342095
4650831701
5651353286
5898867216
5908543049
5757180880
5209629180
4476079122
4718678264
5784973501
5886107254
6083493738
5834425114
5319022977
4435215936
4755513569
5817302588
5855661069
5936495170
5627291803
5117915322
4279142068
4624122105
5790775161
5830737343
6000677276
5808394185
5851103332
4809790210
5278695872
6225956892
6762341642
6211733604
6034369938
3768992361
1804737183
1635778234
2235858401
2268794906
2360329272
2360381065
2193025879
1960964953
3123169423
5221736622
5142912953
5333606395
5650919873
5036696795
3843248314
4429773654
5382351306
5352408701
5458293079
5408661363
4826192420
3868847257
4164384790
5589399894
5809811045
5660143002
5484426334
4303317558
2690164572
3342528330
5248466021
5712622080
5969411270
6007725611
5102071617
4055696817
4834980459
6183519125
6218299647
5977560092
5682389059
4864143095
3728769169
4418904579
6091000942
5979140859
5869197387
5807636756
5304990109
3928518872
4758707732
6022019325
5776071709
5735104777
5615200704
4877084719
4094662813
4522593739
5367079399
5511215139
5042132009
4056810998
2793298199
1428649917
1186166966
2012375867
1946733977
2016588775
1835897584
1743009893
917860420
1139584892
1883889600
1943110250
2142801639
2195849604
2024998546
1270055616
1132677045
1157946046
1945224736
2040064579
1916912033
1739659296
1096412465
1214940241
1893855951
288225644
2960
1649085010
1707810866
1136350753
1323314899
1993603195
2086387513
2263594103
2007500860
1788492121
1120244540
1240256644
2278547628
2399308307
2372948831
2297285854
2095208559
1145811310
1206556669
2396742051
2156678465
2274005024
2366410649
2031408782
1080790583
1237452818
2127130331
2273227323
2377595093
2191086134
1137987737
824627765
992193078
2083674321
2235891920
2252268008
2111998257
2206412038
1213817801
1340531791
2381361619
2641441038
2610699316
2356842503
2086966844
1072821817
1217724209
2376501957
2220323613
61014081
3024
3473
3473
3473
3472
3472
3473
3472
3473
3472
3472
3474
3473
2365266868
2824598677
2482504628
1211319014
1021058871
2045877135
2013671340
2242238071
1994607380
1918542754
1041475687
1263351199
2207452854
2267041497
339472739
1981813504
1977993332
1220569581
1493765207
2366714937
2430657187
2437320856
2536086310
2550617780
2141997760
2679624412
4122109395
4900336395
5715730066
5625994953
4487402852
3285305710
3432983159
4118564393
5610954911
6091010710
5766121707
5308813953
3503858023
4450866157
5955908255
6324177084
6913143659
6692163319
5920889197
4339534562
5069741608
6241413667
6236980477
6319597893
6364522913
5437164631
3830633300
4816592061
6133021854
6274689621
6306555158
6287846654
5646792004
4392800202
5107495369
6385656416
6268267285
6228302724
6346685770
5261241170
4027136355
4543319904
6253146701
6661384362
6884939625
6504829969
5332609304
3547450984
4704184007
6527930217
6585299427
2993212995
2961
2960
2960
2960
2960
2960
2961
2960
2960
2961
2960
2960
2960
2960
2960
2960
2960
2960
2961
2961
2960
2960
2960
2961
2960
2961
2961
2960
2960
2960
2960
2961
2960
2960
2960
2960
2960
2960
2960
2960
2960
2960
2960
2960
2960
2960
2961
2960
2961
2960
2960
2961
2960
2960
2960
2962
2961
2961
2960
2960
2960
2960
2960
2960
2961
2960
2960
2960
2961
2960
2960
2960
2960
2960
2960
2960
2961
2960
2961
2960
2960
2960
2960
2960
2960
2960
2960
2961
2960
2960
2960
2960
2960
2960
2960
2960
2960
2960
2960
2960
2959
2959
2960
2960
2960
2960
2960
453273459
5200520021
7159387124
7870116290
7798492489
7083796573
6183571277
5009674025
5499271638
7108329007
7578958700
7504361839
7360029337
6056047879
5246909919
5803861033
7526367782
8095482547
8098059022
7439427266
6737100177
5397904762
6019412905
7761690497
8111117125
7876834779
7433146597
5273754036
2605383377
2174631801
2905585382
2912745162
2918763275
2926497467
2850477405
2593172194
4336190730
7595647313
7471706877
7391143100
6704130069
6876759506
5504168783
6091732459
8011501049
8751184606
9420789274
7621265105
5504495482
3889411048
4536195177
7341283288
7607003999
7565325237
7411657771
6816288511
802960034
2976
2976
2976
2976
2976
3030
4428526467
6194401674
7902939094
8523358034
7963619724
7406339045
6556959545
5038661289
5719432523
7389057653
7848866036
7638801983
7982158540
6811699630
4922583343
6162654993
7729233840
7912609787
7985458664
7797798004
6799435276
6050907592
6468456070
7431533269
7499246635
7559513842
5601537750
3587930703
1918968499
1527112657
2590414953
2688841519
2749319726
383283205
2976
4235
3680
3490
2595107461
2645894239
2677373878
2357236258
1131410013
1234254308
2400699197
2408349860
2318175428
2415442670
2204186554
1203494783
1102974405
1287523607
2511369475

此数据有 12 个月的值,每个月有 ~31 天

This data has values for 12 months, each month has ~31 days

这是我正在使用的 R 代码:

Here's the R code that I'm using:

library(forecast)
mydata = read.csv("values.csv")
seasons <- msts(mydata, seasonal.periods = c(12,372))
fit_model <- tbats(seasons)
fcst <- forecast.tbats(fit_model,h=31,level=90)

这给了我错误:

tau + 1 + adj.beta + object$p 中的错误:二元运算符的非数字参数

我做错了什么?以及如何纠正?另外,有些月份有 30 天,有些月份有 31 天,2 月份有 28 天.有没有办法在数据中说明这一点?现在,我只是在所有月份中使用31"天——这是不正确的.

What am I doing wrong? And how to correct it? Also, some months have 30 days, some have 31, Feb has 28. Is there a way to account for this in the data? Right now, I'm just using '31' days in all months -- which is incorrect.

推荐答案

该函数返回的是 bats 类的模型,而不是 tbats 类,因为没有确定季节性.只需使用forecast 函数而不是forecast.tbats.您正在尝试告诉 R 使用哪种预测方法,当它完全有能力自行解决时.

The function is returning a model of class bats not tbats because there is no seasonality identified. Just use the forecast function rather than forecast.tbats. You are trying to tell R which forecast method to use, when it is more than capable of figuring that out itself.

我现在更新了forecast.tbats() 函数以防止错误.github上的更新版本.

I've now updated the forecast.tbats() function to prevent error. Updated version on github.

这篇关于TBATS 的时间序列预测/预测失败,“tau + 1 + adj.beta + object$p"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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