Created
June 17, 2018 12:40
-
-
Save wilsonfreitas/8498302a98f301b80b5161be3b4fe9ac to your computer and use it in GitHub Desktop.
This file contains hidden or 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
library(tseries) | |
library(magrittr) | |
library(ggplot2) | |
data(EuStockMarkets) | |
dax <- diff(log(EuStockMarkets))[,"DAX"] | |
dax.garch <- garch(dax) | |
dax.garch | |
tidy(dax.garch) | |
glance(dax.garch) | |
augment(dax.garch, dax) %>% head() | |
augment(dax.garch, dax) %>% | |
ggplot(aes(x = .time, y = data)) + | |
geom_line() + | |
geom_line(aes(y = .fitted*2.32), colour = "red") | |
smp1 = window(dax, end = c(1997, frequency(dax))) | |
smp2 = window(dax, start = c(1998, 1)) | |
dax.garch <- garch(smp1) | |
augment(dax.garch, newdata = smp2) %>% | |
ggplot(aes(x = .time, y = newdata)) + | |
geom_line() + | |
geom_line(aes(y = .fitted*2.32), colour = "red") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment