View source: R/variance_estimation.R
variance_arma | R Documentation |
Estimate the variance for each block and then take the average.
variance_arma(data, p, q, max_order = p * q)
variance.arma(data, p, q, max_order = p * q)
data |
A one-column matrix or a vector. |
p |
The order of the autoregressive part. |
q |
The order of the moving average part. |
max_order |
The maximum order of the AR model to consider. |
A numeric value representing the variance.
set.seed(1)
n <- 300
w <- rnorm(n + 3, 0, 10)
x <- rep(0, n + 3)
for (i in 1:200) {
x[i + 3] <- 0.1 * x[i + 2] - 0.3 * x[i + 1] + 0.1 * x[i] +
0.1 * w[i + 2] + 0.5 * w[i + 1] + w[i + 3]
}
for (i in 201:n) {
x[i + 3] <- 0.3 * x[i + 2] + 0.1 * x[i + 1] - 0.3 * x[i] -
0.6 * w[i + 2] - 0.1 * w[i + 1] + w[i + 3]
}
(result <- variance.arma(x[-seq_len(3)], p = 3, q = 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.