问题描述
新年快乐!
Length(x) = 35064,or 366*24 + 3*365*24.
问题是数据包括闰年 - 2016 年的值,我想用它来预测 2020 年(很多人想忘记的年份)。我无法从此数据创建行号 = 8784 的矩阵,因为原始数据中的年份长度为 365.25*24
,因此我必须手动包含 2 月 29 日。
到目前为止,这是我的代码:
library(tidyverse)
library(tsibble)
library(fable)
library(feasts)
library(lubridate)
# Remove February 29 from data
tmp <- x %>%
filter(datetime <= "2016-02-28 23:30" | datetime >= "2016-03-01 00:00")
# Bootstrap data
tempsim <- forecast::bld.mbb.bootstrap(tmp$temp1,num = 100,block_size = 24)
# Create matrix and compute the means
tempsim <- sapply(tempsim,unlist)
tempsim <- matrix(tempsim,nrow = 8760)
tempsim <- rowMeans(tempsim)
# Add February 29th
a <- matrix(c(6.631599,6.733649,6.385545,6.087687,6.139491,6.297789,6.841701,7.195739,7.441793,7.758391,7.600092,7.302234,7.910756,8.054760,7.948265,8.000068,7.297858,7.437417,6.191294,6.647451))
# Add this to the simulated temperature:
temp <- append(tempsim,a,after = 1417)
当然,只能使用 2016 年进行引导,但随后剩余年份的所有信息都会丢失。我希望有某种方法可以包含所有四年的数据并创建具有 8784 行的矩阵。任何帮助将不胜感激。
祝大家新年快乐!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)