Fix time-varying weights plot
This commit is contained in:
25
index.qmd
25
index.qmd
@@ -795,17 +795,15 @@ Berrisch, J., & Ziel, F. [-@BERRISCH2023105221]. *Journal of Econometrics*, 237(
|
||||
|
||||
```{r, echo = FALSE, fig.height=8, cache = TRUE}
|
||||
par(mfrow = c(3, 3), mar = c(2, 2, 2, 2))
|
||||
set.seed(1)
|
||||
set.seed(42)
|
||||
# Data
|
||||
X <- matrix(ncol = 3, nrow = 15)
|
||||
X[, 1] <- seq(from = 8, to = 12, length.out = 15) + 0.25 * rnorm(15)
|
||||
X[, 2] <- 10 + 0.25 * rnorm(15)
|
||||
X[, 3] <- seq(from = 12, to = 8, length.out = 15) + 0.25 * rnorm(15)
|
||||
X <- matrix(ncol = 2, nrow = 15)
|
||||
X[, 1] <- seq(from = 8, to = 12, length.out = 15) + 0.4 * rnorm(15)
|
||||
X[, 2] <- seq(from = 12, to = 8, length.out = 15) + 0.4 * rnorm(15)
|
||||
# Weights
|
||||
w <- matrix(ncol = 3, nrow = 15)
|
||||
w <- matrix(ncol = 2, nrow = 15)
|
||||
w[, 1] <- sin(0.1 * 1:15)
|
||||
w[, 2] <- cos(0.1 * 1:15)
|
||||
w[, 3] <- seq(from = -2, 0.25, length.out = 15)^2
|
||||
w[, 2] <- seq(from = -2, 0.25, length.out = 15)^2
|
||||
w <- (w / rowSums(w))
|
||||
# Vis
|
||||
plot(X[, 1],
|
||||
@@ -825,27 +823,24 @@ plot(w[, 1],
|
||||
xlab = "",
|
||||
ylab = "", xaxt = "n", yaxt = "n", bty = "n", col = "#80C684FF"
|
||||
)
|
||||
text(6, 0.5, TeX("$w_1(t)$"), cex = 2, col = "#80C684FF")
|
||||
text(6, 0.5, latex2exp::TeX("$w_1(t)$"), cex = 2, col = "#80C684FF")
|
||||
arrows(13, 0.25, 15, 0.0, , lwd = 4, bty = "n", col = "#414141FF")
|
||||
plot.new()
|
||||
plot.new()
|
||||
plot.new()
|
||||
|
||||
text(6, 0.6, TeX("$w_2(t)$"), cex = 2, col = "#FFD44EFF")
|
||||
arrows(13, 0.5, 15, 0.5, , lwd = 4, bty = "n", col = "#414141FF")
|
||||
plot(rowSums(X * w), lwd = 4, type = "l", xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n", col = "#D81A5FFF")
|
||||
plot(X[, 3],
|
||||
plot(X[, 2],
|
||||
lwd = 4,
|
||||
type = "l", ylim = c(8, 12),
|
||||
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n", col = "#FFD44EFF"
|
||||
)
|
||||
plot(w[, 3],
|
||||
plot(w[, 2],
|
||||
lwd = 4, type = "l",
|
||||
ylim = c(0, 1),
|
||||
xlab = "",
|
||||
ylab = "", xaxt = "n", yaxt = "n", bty = "n", col = "#FFD44EFF"
|
||||
)
|
||||
text(6, 0.25, TeX("$w_2(t)$"), cex = 2, col = "#FFD44EFF")
|
||||
text(6, 0.25, latex2exp::TeX("$w_2(t)$"), cex = 2, col = "#FFD44EFF")
|
||||
arrows(13, 0.75, 15, 1, , lwd = 4, bty = "n", col = "#414141FF")
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user