gpt4 book ai didi

r - 使用 checkresiduals() 函数检查残差(来自 ETS+STL 方法)

转载 作者:行者123 更新时间:2023-12-05 07:23:08 28 4
gpt4 key购买 nike

我有一个 ts 对象,其中包含一列 2016-2019 年期间(从 2019 年开始只有一周)的每周数据(频率 = 52)。

   #>TEST_1
#>Time Series:
#>Start = c(2016, 1)
#>End = c(2019, 1)
#>Frequency = 52

因此,我使用预测包中的函数 forcast() 使用此 ts 对象执行预测。此函数为我的系列选择了最佳模型 ETS(指数平滑)。

Forecast method: STL +  ETS(M,A,N)

Model Information:
ETS(M,A,N)

Call:
ets(y = x, model = etsmodel, allow.multiplicative.trend = allow.multiplicative.trend)

Smoothing parameters:
alpha = 0.0044
beta = 0.0044

Initial states:
l = 496.0001
b = -0.7495

sigma: 0.2538

AIC AICc BIC
2328.009 2328.406 2343.290

但是这里出现了一个新问题。也就是说,我尝试使用函数 checkresiduals() 对该模型的残差执行残差诊断,但我收到了这条消息。

#>  Warning message:
#> In modeldf.default(object) :
#> Could not find appropriate degrees of freedom for this model.

那么谁能帮我找到这个模型合适的自由度使用 checkresiduals() 函数?以下是残差数据。

residuals<-structure(c(103.861587225712, 232.922530738897, -177.501044573567, 
-32.3310448885088, 51.8658720663952, -127.669525632371, -21.3736988850188,
31.8283388622758, 134.388167819753, -202.279672375648, -150.211885150427,
59.7872220312138, 7.21928088178879, -31.0067512774922, 240.664063232754,
-259.693899860492, 51.2068097649542, 133.051059120384, 153.754774108432,
-245.448120335887, -41.7151580882252, 329.736089553496, -176.574681226445,
-5.49877539363433, -57.9440644242901, -141.920372666123, 59.631632197218,
30.3566233456523, -19.5674149569647, 49.8299466802158, 8.08039437858747,
-179.219757481181, 61.6262480548803, 14.2886335749734, 147.521659709062,
-203.114556948222, 232.39658682842, 17.0359701527633, 122.671792930753,
1.17404214154658, -21.3604900851155, 43.6067134825538, 56.6694972222097,
-74.206099457236, 22.2154797604099, -42.6209506582884, -69.0881062270763,
44.9935627424999, -65.4843011281191, 45.9859871219855, 38.48475732006,
217.607886572158, -81.752879329815, -62.3165846738133, 91.3280029935076,
13.8065979268541, -27.5160607993942, -2.45614326754531, 8.82428074173083,
-21.9816546447523, 58.6350169306539, 2.99591624137327, 25.4548944489055,
-7.80971451574547, -33.741824891111, 148.727324165574, -103.887619405031,
13.6976122890256, -6.22642628362576, -89.0151943344358, 151.68500527824,
113.373271376477, 165.103295852743, -295.039665234726, 213.698114407198,
-76.4034402042766, -9.34573346398901, -71.4103830503603, 122.800589573655,
-55.724016585403, 63.7939569095491, 44.9784699409192, 151.519180259845,
-58.4408170188741, -74.3037359893916, -47.7713298497972, 163.367074626196,
-249.379445021869, -112.112655284116, -43.5458433646284, -53.5666005867634,
281.491207440336, -121.212142480196, -33.9138735682901, -31.1438180301793,
-31.2555698825003, 20.3181357200996, -46.2564548372715, 19.2769399131227,
82.0903051423776, -53.9874588993755, -81.7381076026692, -109.42037514781,
-128.567530337503, 239.606771386708, -163.928615298084, 88.3650587021525,
22.3840519205474, -19.7936259061341, 133.392615761316, 14.8789465334592,
-7.35384302392632, -193.309220279654, 199.807229000058, 124.081926626315,
-52.3795507957004, 26.248230162833, -123.352126375918, -136.687848362162,
242.06397333675, -49.2896526387001, -47.0413692896267, -315.639803224046,
122.111855110991, -135.453045844048, -34.9514109509343, -51.0671430546247,
75.2304903204274, 58.5168476811577, 205.900859581612, -195.231017102347,
17.0666471041718, -55.7835085816988, -105.931678098968, -173.52733115843,
229.313605012801, 4.76417288414814, 24.9291766474627, -324.904858037879,
449.500524512662, -126.709163220759, 18.7291455153395, -76.1328146141673,
-298.217791616455, 137.973841964018, -16.2916958267025, -31.8650948708939,
99.4876416447454, -49.4760819558044, 84.1071094148195, 44.155870901787,
-133.53348599245, 117.30321085781, 35.0222913102854, 71.5981819455558,
-87.2032279610021, -272.900607282635), .Tsp = c(2016, 2019, 52
), class = "ts")

最佳答案

自由度为:DF = (# lags to be tested) - (# parameters that you estimate).

您可以使用以下方式手动设置自由度:

checkresidual(..., df=DF)

希望它有效。鹅

关于r - 使用 checkresiduals() 函数检查残差(来自 ETS+STL 方法),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56183160/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com