我可以就如何将该分布更改为80%95%置信区间提供一些指导吗?谢谢!
您可以在此处使用示例代码来获取发行版
result <–USAccDeaths %>% as_tsibble %>%
model(arima = ARIMA(log(value) ~ pdq(0,1,1) + PDQ(0,1,1)))%>%
forecast(h=12)
答案 0 :(得分:0)
目前有两种推荐的方法可以从分布中提取区间。 hilo()
允许您计算间隔,这与mutate()
很好地配合。 report()
还允许您通过level
参数获取间隔,这可能更方便。
hilo()
不太可能改变,但是report()
的未来不确定。
library(tidyverse)
library(fable)
#> Loading required package: fablelite
result <- USAccDeaths %>% as_tsibble %>%
model(arima = ARIMA(log(value) ~ pdq(0,1,1) + PDQ(0,1,1)))%>%
forecast(h=12)
result %>%
mutate(`80%` = hilo(.distribution, 80))
#> # A tsibble: 12 x 5 [1M]
#> # Key: .model [1]
#> .model index value .distribution `80%`
#> <chr> <mth> <dbl> <dist> <hilo>
#> 1 arima 1979 Jan 8290. t(N(9.0, 0.0014)) [ 7899.082, 8689.169]80
#> 2 arima 1979 Feb 7453. t(N(8.9, 0.0018)) [ 7055.860, 7859.100]80
#> 3 arima 1979 Mar 8276. t(N(9.0, 0.0022)) [ 7789.719, 8774.054]80
#> 4 arima 1979 Apr 8584. t(N(9.1, 0.0025)) [ 8036.304, 9144.752]80
#> 5 arima 1979 May 9499. t(N(9.2, 0.0029)) [ 8849.860, 10166.302]80
#> 6 arima 1979 Jun 9900. t(N(9.2, 0.0033)) [ 9180.375, 10639.833]80
#> 7 arima 1979 Jul 10988. t(N(9.3, 0.0037)) [10145.473, 11857.038]80
#> 8 arima 1979 Aug 10132. t(N(9.2, 0.0041)) [ 9315.840, 10974.140]80
#> 9 arima 1979 Sep 9138. t(N(9.1, 0.0045)) [ 8368.585, 9933.124]80
#> 10 arima 1979 Oct 9391. t(N(9.1, 0.0049)) [ 8567.874, 10243.615]80
#> 11 arima 1979 Nov 8863. t(N(9.1, 0.0052)) [ 8056.754, 9699.824]80
#> 12 arima 1979 Dec 9356. t(N(9.1, 0.0056)) [ 8474.732, 10271.739]80
result %>%
report(level = 80)
#> # A tsibble: 12 x 4 [1M]
#> # Key: .model [1]
#> .model index value `80%`
#> <chr> <mth> <dbl> <hilo>
#> 1 arima 1979 Jan 8290. [ 7899.082, 8689.169]80
#> 2 arima 1979 Feb 7453. [ 7055.860, 7859.100]80
#> 3 arima 1979 Mar 8276. [ 7789.719, 8774.054]80
#> 4 arima 1979 Apr 8584. [ 8036.304, 9144.752]80
#> 5 arima 1979 May 9499. [ 8849.860, 10166.302]80
#> 6 arima 1979 Jun 9900. [ 9180.375, 10639.833]80
#> 7 arima 1979 Jul 10988. [10145.473, 11857.038]80
#> 8 arima 1979 Aug 10132. [ 9315.840, 10974.140]80
#> 9 arima 1979 Sep 9138. [ 8368.585, 9933.124]80
#> 10 arima 1979 Oct 9391. [ 8567.874, 10243.615]80
#> 11 arima 1979 Nov 8863. [ 8056.754, 9699.824]80
#> 12 arima 1979 Dec 9356. [ 8474.732, 10271.739]80
由reprex package(v0.2.1)于2019-02-27创建