首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >报表模型与mable分开

报表模型与mable分开
EN

Stack Overflow用户
提问于 2020-07-23 06:38:28
回答 1查看 112关注 0票数 2

如何从mable中单独报告每个模型。

示例代码(来自https://otexts.com/fpp3/holt-winters.html)

代码语言:javascript
复制
library(fabletools)
library(fable)
library(forecast)
library(tsibble)
library(feasts)

aus_holidays <- tourism %>%
  filter(Purpose == "Holiday") %>%
  summarise(Trips = sum(Trips))

fit <- aus_holidays %>%
  model(
    additive = ETS(Trips ~ error("A") + trend("A") + season("A")),
    multiplicative = ETS(Trips ~ error("M") + trend("A") + season("M"))
  )
fc <- fit %>% forecast(h = "3 years")

fc %>%
  autoplot(aus_holidays, level = NULL) + xlab("Year") +
  ylab("Overnight trips (millions)") +
  scale_color_brewer(type = "qual", palette = "Dark2")

在上面的例子中,我想分别报告加法模型和乘法模型。我尝试过report(fc$additive),但这不起作用。或者,我可以一次适合一个模型,然后使用report(fc)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-07-23 08:08:21

如果我们使用report(fc),我们会得到一个非常有用的警告消息:

代码语言:javascript
复制
> fit %>% report()
# A tibble: 2 x 9
  .model               sigma2 log_lik   AIC  AICc   BIC     MSE    AMSE      MAE
  <chr>                 <dbl>   <dbl> <dbl> <dbl> <dbl>   <dbl>   <dbl>    <dbl>
1 additive       189416.        -657. 1332. 1335. 1354. 170475. 180856. 315.    
2 multiplicative      0.00213   -657. 1332. 1334. 1353. 171077. 182840.   0.0331
Warning message:
In report.mdl_df(.) :
  Model reporting is only supported for individual models, so a glance will be shown. To see the report for a specific model, use `select()` and `filter()` to identify a single model.

如果我们遵循这个建议,我们就会得到各个模型的报告输出。

代码语言:javascript
复制
> fit %>% select(additive) %>% report()
Series: Trips 
Model: ETS(A,A,A) 
  Smoothing parameters:
    alpha = 0.236428 
    beta  = 0.02978683 
    gamma = 0.0001000204 

  Initial states:
        l         b        s1        s2        s3      s4
 9898.697 -37.39721 -538.1971 -683.9969 -289.7464 1511.94

  sigma^2:  189416.5

     AIC     AICc      BIC 
1332.270 1334.841 1353.708 
> fit %>% select(multiplicative) %>% report()
Series: Trips 
Model: ETS(M,A,M) 
  Smoothing parameters:
    alpha = 0.1864709 
    beta  = 0.02476546 
    gamma = 0.0001001247 

  Initial states:
        l         b        s1        s2        s3      s4
 9852.791 -33.41186 0.9425605 0.9255899 0.9699594 1.16189

  sigma^2:  0.0021

     AIC     AICc      BIC 
1331.853 1334.424 1353.291 
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63044163

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档