test_that("Persistence method behave as expected",
{
#Situation A: +Zero; (generally) correct if jump, wrong otherwise
- pred00_sd = computeForecast(data00, indices, "Persistence", "Zero", Inf, 24, same_day=TRUE)
- pred00_dd = computeForecast(data00, indices, "Persistence", "Zero", Inf, 24, same_day=FALSE)
+ pred00_sd = computeForecast(data00, indices, "Persistence", "Zero", Inf, 24,
+ same_day=TRUE)
+ pred00_dd = computeForecast(data00, indices, "Persistence", "Zero", Inf, 24,
+ same_day=FALSE)
for (i in 1:7)
{
expect_equal(pred00_sd$getSerie(i), rep(pred_order[i],24))
expect_equal(pred00_dd$getSerie(i), rep(pred_order[i],24))
}
- pred13_sd = computeForecast(data13, indices, "Persistence", "Zero", Inf, 24, same_day=TRUE)
- pred13_dd = computeForecast(data13, indices, "Persistence", "Zero", Inf, 24, same_day=FALSE)
+ pred13_sd = computeForecast(data13, indices, "Persistence", "Zero", Inf, 24,
+ same_day=TRUE)
+ pred13_dd = computeForecast(data13, indices, "Persistence", "Zero", Inf, 24,
+ same_day=FALSE)
for (i in 2:6)
{
expect_equal(pred13_sd$getSerie(i), c( rep(i,11), rep(i%%7+1,13) ) )
test_that("Neighbors method behave as expected",
{
#Situation A: +Zero; correct if jump, wrong otherwise
- pred00 = computeForecast(data00, indices, "Neighbors", "Zero", Inf, 24, simtype="mix")
+ pred00 = computeForecast(data00, indices, "Neighbors", "Zero", Inf, 24,
+ simtype="mix")
for (i in 1:7)
expect_equal(pred00$getSerie(i), rep(pred_order[i],24))
- pred13 = computeForecast(data13, indices, "Persistence", "Zero", Inf, 24, simtype="mix")
+ pred13 = computeForecast(data13, indices, "Persistence", "Zero", Inf, 24,
+ simtype="mix")
for (i in 1:7)
expect_equal(pred13$getSerie(i), c( rep(i,11), rep(i%%7+1,13) ) )
#Situation B: +Neighbors, always predict bad (small, averaged) jump
- pred00 = computeForecast(data00, indices, "Neighbors", "Neighbors", Inf, 24, simtype="endo")
- #Concerning weights, there are 12+(1 if i>=2) gaps at -6 and 90-12+(i-2 if i>=3) gaps at 1
- #Thus, predicted jump is respectively
+ pred00 = computeForecast(data00, indices, "Neighbors", "Neighbors", Inf, 24,
+ simtype="endo")
+ #Concerning weights, there are 12+(1 if i>=2) gaps at -6 and 90-12+(i-2 if i>=3) gaps
+ #at 1. Thus, predicted jump is respectively
# (12*-6+78)/90 = 0.06666667
# (13*-6+78)/91 = 0
# (13*-6+79)/92 = 0.01086957
for (i in 1:7)
expect_equal(pred00$getSerie(i), rep(pred_order[i]+jumps[i],24))
- #Next lines commented out because too unpredictable results (tendency to flatten everything...)
-# pred13 = computeForecast(data13, indices, "Neighbors", "Neighbors", Inf, 24, simtype="endo")
+ #Next lines commented out because too unpredictable results
+ #(tendency to flatten everything...)
+# pred13 = computeForecast(data13, indices, "Neighbors", "Neighbors", Inf, 24,
+# simtype="endo")
# for (i in 1:7)
# expect_equal(pred13$getSerie(i), c( rep(i,11), rep(i%%7+1,13) ) )