-
-
Save BroVic/7eafc3973aaaf27c3cea77b146a1e30f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Intuition of the MA model based on https://www.youtube.com/watch?v=voryLhxiPzE | |
dat <- data.frame(f.hat = NA, epsilon = c(-2, 1, 0, 2, 1), f = NA) | |
mu <- 10 | |
phi <- .5 | |
for (i in seq(nrow(dat))) { | |
if (i == 1L) | |
dat$f.hat[i] <- mu | |
else | |
dat$f.hat[i] <- mu + phi * dat$epsilon[i - 1] | |
dat$f[i] <- dat$f.hat[i] + dat$epsilon[i] | |
} | |
dat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment