Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<html>
<head>
<meta charset="utf-8" />
<meta name="generator" content="R package animation 2.7">
<title>Animations Using the R Language</title>
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/scianimator.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/github.min.css">
<script src="js/jquery-1.4.4.min.js"></script>
<script src="js/jquery.scianimator.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/languages/r.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body>
<div class="scianimator"><div id="Rplot" style="display: inline-block;"></div></div>
<div class="scianimator" style="width: 1600px; text-align: left"><pre><code class="r">## Animations generated in R version 4.4.1 (2024-06-14) using the package animation
library(animation)
library(RColorBrewer)
library(onlineforecast)
library(quantreg)
library(SparseM)
library(testthat)
library(devtools)
library(usethis)
for (i in k:(60)) {
par(mfrow = c(2, 1))
par(mar = c(2, 4, 2, 2))
with(Pred_model, {
plot(Dtrain$t[(i - 10):(i + k)], Dtrain$Ps[(i - 10):(i +
k)], bty = "l", lwd = 2, col = "black", pch = 19,
cex = 0.5, axes = FALSE, xaxt = "n", type = "n",
ylim = range(Dtrain$Ps[(i - 10):(i + k)], q0.5[i,
], q0.95[i, ], q0.05[i, ], na.rm = T), main = "TimeAdaptive with Weights",
xlab = "Time", ylab = "Ps")
axis(2)
polygon(c(Dtrain$t[(i + 1):(i + k)], rev(Dtrain$t[(i +
1):(i + k)])), c(Pred_model$q0.05[i, ], rev(Pred_model$q0.2[i,
])), col = colSeq[3], border = NA)
polygon(c(Dtrain$t[(i + 1):(i + k)], rev(Dtrain$t[(i +
1):(i + k)])), c(Pred_model$q0.8[i, ], rev(Pred_model$q0.95[i,
])), col = colSeq[3], border = NA)
polygon(c(Dtrain$t[(i + 1):(i + k)], rev(Dtrain$t[(i +
1):(i + k)])), c(Pred_model$q0.2[i, ], rev(Pred_model$q0.5[i,
])), col = colSeq[4], border = NA)
polygon(c(Dtrain$t[(i + 1):(i + k)], rev(Dtrain$t[(i +
1):(i + k)])), c(Pred_model$q0.5[i, ], rev(Pred_model$q0.8[i,
])), col = colSeq[4], border = NA)
lines(Dtrain$t[(i - 10):(i + k)], Dtrain$Ps[(i -
10):(i + k)], col = "black", type = "b", lwd = 2)
lines(Dtrain$t[(i + 1):(i + k)], q0.5[i, ], type = "b",
col = "grey", lwd = 2)
axis.POSIXct(side = 1, x = Dtrain$t[(i - 10):(i +
k)], at = seq(from = Dtrain$t[(i - 10):(i + k)][1],
to = Dtrain$t[(i - 10):(i + k)][length(Dtrain$t[(i -
10):(i + k)])], by = "1 hour"), format = "%Y/%m/%d %H:%M \n %a",
las = 1, cex.axis = 1, srt = 45)
plot(Dtrain$t[(i - 10):(i + k)], c(rep(NA, 11), as.numeric(Dtrain$I[i,
1:k])), type = "b", col = "steelblue", axes = FALSE,
xlab = "Time", ylab = "Temp", lwd = 2, ylim = range(Dtrain$I[i,
1:k], Dtrain$Iobs[(i + 1):(i + k)]))
lines(Dtrain$t[(i + 1):(i + k)], Dtrain$Iobs[(i +
1):(i + k)], type = "b", col = "red", lwd = 2)
axis(2)
abline(h = 0, v = Dtrain$t[i], lty = 2, col = "lightgrey",
lwd = 2)
legend("topleft", legend = c("Ta Obs", "Ta Pred"),
col = c("red", "steelblue"), lty = 1, cex = 1,
lwd = 2)
i
axis.POSIXct(side = 1, x = Dtrain$t[(i - 10):(i +
k)], at = seq(from = Dtrain$t[(i - 10):(i + k)][1],
to = Dtrain$t[(i - 10):(i + k)][length(Dtrain$t[(i -
10):(i + k)])], by = "1 hour"), format = "%Y/%m/%d %H:%M \n %a",
las = 1, cex.axis = 1, srt = 45)
})
}
## R version 4.4.1 (2024-06-14)
## Platform: x86_64-pc-linux-gnu
## Other packages: animation 2.7, RColorBrewer 1.1-3, onlineforecast
## 1.0.2, quantreg 5.99, SparseM 1.84-2, testthat 3.2.1.1, devtools 2.4.5,
## usethis 3.0.0</code></pre></div>
<script src="js/Rplot.js"></script>
<!-- highlight R code -->
</body>
</html>