fit_ARHp_FPCA {fdaACF} | R Documentation |
Fit an ARH(p) to a given functional time series
Description
Fit an ARH(p)
model to a given functional
time series. The fitted model is based on the model proposed
in (Aue et al, 2015), first decomposing the original
functional observations into a vector time series of n_harm
FPCA scores, and then fitting a vector autoregressive
model of order p
(VAR(p)
) to the time series
of the scores. Once fitted, the Karhunen-Loève expansion
is used to re-transform the fitted values into functional
observations.
Usage
fit_ARHp_FPCA(y, v, p, n_harm, show_varprop = T)
Arguments
y |
Matrix containing the discretized values
of the functional time series. The dimension of the
matrix is |
v |
Numeric vector that contains the discretization points of the curves. |
p |
Numeric value specifying the order of the functional autoregressive model to be fitted. |
n_harm |
Numeric value specifying the number
of functional principal components to be used when fitting
the |
show_varprop |
Logical. If |
References
Aue, A., Norinho, D. D., Hormann, S. (2015). On the Prediction of Stationary Functional Time Series Journal of the American Statistical Association, 110, 378–392. https://doi.org/10.1080/01621459.2014.909317
Examples
# Example 1
# Simulate an ARH(1) process
N <- 250
dv <- 20
v <- seq(from = 0, to = 1, length.out = 20)
phi <- 1.3 * ((v) %*% t(v))
persp(v,v,phi,
ticktype = "detailed",
main = "Integral operator")
set.seed(3)
white_noise <- simulate_iid_brownian_bridge(N, v = v)
y <- matrix(nrow = N, ncol = dv)
y[1,] <- white_noise[1,]
for(jj in 2:N){
y[jj,] <- white_noise[jj,];
y[jj,]=y[jj,]+integral_operator(operator_kernel = phi,
v = v,
curve = y[jj-1,])
}
# Fit an ARH(1) model
mod <- fit_ARHp_FPCA(y = y,
v = v,
p = 1,
n_harm = 5)
# Plot results
plot(v, y[50,], type = "l", lty = 1, ylab = "")
lines(v, mod$y_est[50,], col = "red")
legend("bottomleft", legend = c("real","est"),
lty = 1, col = c(1,2))