make_series <- function(a1, a2 = 0, length_out = 100) {
y <- numeric(length_out)
y[1] <- 0
y[2] <- rnorm(1)
for (t in 3:length_out) {
y[t] <- a1 * y[(t - 1)] + a2 * y[(t - 2)] + rnorm(1)
}
return(y)
}
set.seed(100)
ts_plot <- data_frame(N = make_series(0.5, 0.5001),
t = 1:100) %>%
ggplot(aes(t, N)) +
theme_classic() +
theme(axis.text = element_blank(), axis.ticks = element_blank(),
axis.title = element_blank()) +
geom_line(size = 0.5, color = 'firebrick1')
## Warning: `data_frame()` was deprecated in tibble 1.1.0.
## ℹ Please use `tibble()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
ggsave('../static/icon/icon.png', ts_plot, width = 1, height = 1, dpi = 64, units = 'in')