Skip to content

forecast::Arima(xreg = XXXX)咱们周易(洲学论拯救亚洲人)道家易经、天文历法、廿四节气、十二时辰、算卜与气象学,<s>「兵法廿四篇」之孔明借东风与草船借箭出现错误信息</s>司马错得蜀既得楚 #9

@englianhu

Description

@englianhu

秦谏启奏


有事启奏,无事退朝

fabletools::accuracy 错误信息

大纲

  • fabletools::accuracy()在咱们R鄀文艺坊和咱们道家终端杏林「牡蛎」有落差。
  • forecast::Arima(xreg = XXXX)咱们道家易经、天文历法、廿四节气、十二时辰、算卜与气象学,「兵法廿四篇」之孔明借东风与草船借箭出现错误信息。

与预期出入/代码有误

问题一:fabletools::accuracy()在咱们R鄀文艺坊和咱们道家终端杏林「牡蛎」有落差如下:

> 外因周期自回归系列 <- bind_rows(list(
+   外因周期自回归甲 = as_tibble(accuracy(外因周期自回归甲)), 
+   外因周期自回归乙 = as_tibble(accuracy(外因周期自回归乙)), 
+   外因周期自回归丙 = as_tibble(accuracy(外因周期自回归丙)),
+   外因周期自回归丁 = as_tibble(accuracy(外因周期自回归丁)), 
+   外因周期自回归戊 = as_tibble(accuracy(外因周期自回归戊)), 
+   外因周期自回归己 = as_tibble(accuracy(外因周期自回归己)),
+   外因周期自回归庾 = as_tibble(accuracy(外因周期自回归庾))), .id = '计数模型')
Error in accuracy(外因周期自回归甲) : 缺少参数"predicted",也没有缺省值
> 外因周期自回归系列
错误: 找不到对象'外因周期自回归系列'

问题二:咱们道家易经、天文历法、廿四节气、十二时辰、算卜与气象学,「兵法廿四篇」之孔明借东风与草船借箭出现错误信息如下:

> 自回归均移模型最优值(tk_xts(总汇[, .(年月日时分, 预测价)]), 外因 = as.matrix(总汇[, .(廿四节气乙, 时辰乙)]))
Using column `年月日时分` for date_var.
Error in auto.arima(样本, D = 季节差分的次数, seasonal = 季节性,  : 
  No suitable ARIMA model found
此外: Warning message:
Non-numeric columns being dropped: 年月日时分

自回归均移模型最优值 <- function(样本, 季节差分的次数 = NULL, 季节性 = '', 规律极限值 = 10, 自回归均移模型值 = FALSE, 外因 = NULL) {
# 通过设置并迭代筹算自回归均移模型中不同`p,d,q`的规律值,来比较并筛选出最低或最大负数的赤池信息量准则,也就是最优统计模型。
#
# 《预测:方法与实践(第三版)》第九章第九节 - 季节性ARIMA模型
# https://otexts.com/fpp3cn/seasonal-arima-cn.html
if (!季节性 %in% c('', '', '', '')) stop('请选择季节性:"勾"或"有"或"是",或者"叉"或"冇"或"否"。')
if (季节性 %in% c('', '')) 季节性 <- TRUE
if (季节性 %in% c('', '')) 季节性 <- FALSE
# 季节差分的次数,一般上使用到的数值是零到二。
半成品 <- auto.arima(样本, D = 季节差分的次数, seasonal = 季节性,
max.order = 规律极限值, xreg = 外因)
if (自回归均移模型值 == FALSE) {
成果 <- arimaorder(半成品)
} else {
#https://stats.stackexchange.com/questions/178577/how-to-read-p-d-and-q-of-auto-arima
成果 <- 半成品$arma
#https://stackoverflow.com/questions/23617662/extract-arima-specificaiton
names(成果) <- c('p', 'q', 'P', 'Q', 's', 'd', 'D')
成果 %<>% .[c(1, 6, 2, 3, 7, 4, 5)]
#(p,d,q) and (P,D,Q) and seasonal period
} #范例:`s` seasonal period = 12 表示十二个月
return(成果)

操作系统信息

$ $ neofetch
        #####           englianhu@Scibrokes 
       #######          ------------------- 
       ##O#O##          OS: RedFlag Desktop 11.0 x86_64 
       #######          Host: 23-p080d 
     ###########        Kernel: 5.10.0-1-amd64 
    #############       Uptime: 2 days, 6 hours, 1 min 
   ###############      Packages: 7971 (dpkg) 
   ################     Shell: bash 5.0.3 
  #################     Resolution: 1920x1080 
#####################   DE: KDE 
#####################   WM: KWin 
  #################     Theme: RedFlag Dark [KDE], Breeze [GTK3] 
                        Icons: RedFlag-Themes-Chinrse-Red [KDE], oxygen [GTK3] 
                        Terminal: konsole 
                        CPU: Intel i5-4590T (4) @ 3.000GHz 
                        GPU: NVIDIA GeForce 710M 
                        GPU: Intel HD Graphics 
                        Memory: 14498MiB / 15901MiB 

#R>  devtools::session_info()$platform
 setting  value
 version  R version 4.3.3 (2024-02-29)
 os       RedFlag Desktop 11.0
 system   x86_64, linux-gnu
 ui       X11
 language zh_CN:en
 collate  zh_CN.UTF-8
 ctype    zh_CN.UTF-8
 tz       Asia/Shanghai
 date     2024-03-29
 pandoc   NA (via rmarkdown)
#R> Sys.info()
 sysname 
 "Linux" 
 release 
 "5.10.0-1-amd64" 
 version 
"#1 SMP Debian 5.10.40-1~rf11u1.2 (2022-09-22)" 
 nodename 
 "Scibrokes" 
 machine 
 "x86_64" 
 login 
 "englianhu" 
 user 
 "englianhu" 
 effective_user 
 "englianhu" 

原本预期结果

> 外因周期自回归系列 <- bind_rows(list(
+     外因周期自回归甲 = as_tibble(accuracy(外因周期自回归甲)), 
+     外因周期自回归乙 = as_tibble(accuracy(外因周期自回归乙)), 
+     外因周期自回归丙 = as_tibble(accuracy(外因周期自回归丙)),
+     外因周期自回归丁 = as_tibble(accuracy(外因周期自回归丁)), 
+     外因周期自回归戊 = as_tibble(accuracy(外因周期自回归戊)), 
+     外因周期自回归己 = as_tibble(accuracy(外因周期自回归己)),
+     外因周期自回归庾 = as_tibble(accuracy(外因周期自回归庾))), .id = '计数模型')
> 外因周期自回归系列
# A tibble: 7 × 8
  计数模型                ME  RMSE   MAE      MPE  MAPE    MASE  ACF1
  <chr>                <dbl> <dbl> <dbl>    <dbl> <dbl>   <dbl> <dbl>
1 外因周期自回归甲  2.44e-14 1.96  1.66  -0.0323  1.53  0.0152   1.00
2 外因周期自回归乙 -4.94e-14 0.801 0.651 -0.00539 0.600 0.00599  1.00
3 外因周期自回归丙 -6.89e-14 1.96  1.66  -0.0323  1.53  0.0152   1.00
4 外因周期自回归丁 -5.33e-14 0.801 0.651 -0.00539 0.600 0.00599  1.00
5 外因周期自回归戊  3.18e-13 1.96  1.66  -0.0323  1.53  0.0152   1.00
6 外因周期自回归己 -2.45e-14 0.799 0.651 -0.00537 0.600 0.00598  1.00
7 外因周期自回归庾  3.66e-14 0.799 0.651 -0.00537 0.600 0.00598  1.00

提案

文献与案例

众卿商议

结论

众方案

  • 方案一
  • 方案二
  • 方案三

最优方案

相关奏折

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions