obtain_autocorrelation: Estimate the autocorrelation function of the series

Description Usage Arguments Value Examples

View source: R/functional_autocorrelation.R

Description

Obtain the empirical autocorrelation function for lags = 0,...,nlags of the functional time series. Given Y_{1},...,Y_{T} a functional time series, the sample autocovariance functions \hat{C}_{h}(u,v) are given by:

\hat{C}_{h}(u,v) = \frac{1}{T} ∑_{i=1}^{T-h}(Y_{i}(u) - \overline{Y}_{T}(u))(Y_{i+h}(v) - \overline{Y}_{T}(v))

where \overline{Y}_{T}(u) = \frac{1}{T} ∑_{i = 1}^{T} Y_{i}(t) denotes the sample mean function. By normalizing these functions using the normalizing factor \int\hat{C}_{0}(u,u)du, the range of the autocovariance functions becomes (0,1); thus defining the autocorrelation functions of the series

Usage

1
2
obtain_autocorrelation(Y, v = seq(from = 0, to = 1, length.out =
  ncol(Y)), nlags)

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

Discretization points of the curves, by default seq(from = 0, to = 1, length.out = 100).

nlags

Number of lagged covariance operators of the functional time series that will be used to estimate the autocorrelation function.

Value

Return a list with the lagged autocorrelation functions estimated from the data. Each function is given by a (m x m) matrix, where m is the number of points observed in each curve.

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
38
39
40
41
42
43
44
45
46
47
48
49
# Example 1

N <- 100
v <- seq(from = 0, to = 1, length.out = 10)
sig <- 2
bbridge <- simulate_iid_brownian_bridge(N, v, sig)
nlags <- 1
lagged_autocor <- obtain_autocorrelation(Y = bbridge,
                                        nlags = nlags)
image(x = v, y = v, z = lagged_autocor$Lag0)


# Example 2
require(fields)
N <- 500
v <- seq(from = 0, to = 1, length.out = 50)
sig <- 2
bbridge <- simulate_iid_brownian_bridge(N, v, sig)
nlags <- 4
lagged_autocov <- obtain_autocovariance(Y = bbridge,
                                        nlags = nlags)
lagged_autocor <- obtain_autocorrelation(Y = bbridge,
                                         v = v,
                                         nlags = nlags)

opar <- par(no.readonly = TRUE)
par(mfrow = c(1,2))
z_lims <- range(lagged_autocov$Lag1)
colors <- heat.colors(12)
image.plot(x = v, 
           y = v,
           z = lagged_autocov$Lag1,
           legend.width = 2,
           zlim = z_lims,
           col = colors,
           xlab = "u",
           ylab = "v",
           main = "Autocovariance")
z_lims <- range(lagged_autocor$Lag1)
image.plot(x = v, 
           y = v,
           z = lagged_autocor$Lag1,
           legend.width = 2,
           zlim = z_lims,
           col = colors,
           xlab = "u",
           ylab = "v",
           main = "Autocorrelation")
par(opar)

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