fit_ARHp_FPCA: Fit an ARH(p) to a given functional time series

Description Usage Arguments References Examples

View source: R/misc.R

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

1
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 (n x m), where n is the number of curves and m is the number of points observed in each curve.

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 ARH(p) model.

show_varprop

Logical. If show_varprop = TRUE, a plot of the proportion of variance explained by the first n_harm functional principal components will be shown. By default show_varprop = TRUE.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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))

fdaACF documentation built on Oct. 23, 2020, 8:05 p.m.

Related to fit_ARHp_FPCA in fdaACF...