View source: R/fastcpd_wrappers.R
fastcpd_garch | R Documentation |
p
, q
) modelsfastcpd_garch()
and fastcpd.garch()
are
wrapper functions of fastcpd()
to find change points in
GARCH(p
, q
) models. The function is similar to fastcpd()
except that the data is by default a one-column matrix or univariate vector
and thus a formula is not required here.
fastcpd_garch(data, order = c(0, 0), ...)
fastcpd.garch(data, order = c(0, 0), ...)
data |
A numeric vector, a matrix, a data frame or a time series object. |
order |
A positive integer vector of length two specifying the order of the GARCH model. |
... |
Other arguments passed to |
A fastcpd object.
fastcpd()
set.seed(1)
n <- 400
sigma_2 <- rep(1, n + 1)
x <- rep(0, n + 1)
for (i in seq_len(200)) {
sigma_2[i + 1] <- 20 + 0.5 * x[i]^2 + 0.1 * sigma_2[i]
x[i + 1] <- rnorm(1, 0, sqrt(sigma_2[i + 1]))
}
for (i in 201:400) {
sigma_2[i + 1] <- 1 + 0.1 * x[i]^2 + 0.5 * sigma_2[i]
x[i + 1] <- rnorm(1, 0, sqrt(sigma_2[i + 1]))
}
result <- suppressWarnings(
fastcpd.garch(x[-1], c(1, 1), include.mean = FALSE)
)
summary(result)
plot(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.