Happy new year!
I have some data, x (temperatures) I want to bootstrap/simulate and use for prediction.
Length(x) = 35064, or 366*24 + 3*365*24.
The problem is the data includes values from a leap year - 2016 and I want to use it for prediction in 2020 (the year many people want to forget). I have trouble creating a matrix with row number = 8784 from this data because the year length in original data is 365.25*24
and so I have to include February 29th manually.
This is my code so far:
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.385545,6.385545,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.139491,6.191294,6.647451))
# Add this to the simulated temperature:
temp <- append(tempsim, a, after = 1417)
Of course, one can use only 2016 for bootstrapping but then all the information in remaining years is lost. I hope there is some way to include all four years of data and create matrix with 8784 rows. Any help will be very appreciated.
I wish everyone a good year!