obtain_autocovariance {fdaACF}R Documentation

Estimate the autocovariance function of the series

Description

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

C^h(u,v)=1Ti=1Th(Yi(u)YT(u))(Yi+h(v)YT(v))\hat{C}_{h}(u,v) = \frac{1}{T} \sum_{i=1}^{T-h}(Y_{i}(u) - \overline{Y}_{T}(u))(Y_{i+h}(v) - \overline{Y}_{T}(v))

where YT(u)=1Ti=1TYi(t) \overline{Y}_{T}(u) = \frac{1}{T} \sum_{i = 1}^{T} Y_{i}(t) denotes the sample mean function.

Usage

obtain_autocovariance(Y, nlags)

Arguments

Y

Matrix containing the discretized values of the functional time series. The dimension of the matrix is (nxm)(n x m), where nn is the number of curves and mm is the number of points observed in each curve.

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 autocovariance functions estimated from the data. Each function is given by a (mxm)(m x m) matrix, where mm is the number of points observed in each curve.

Examples

# 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_autocov <- obtain_autocovariance(Y = bbridge,
                                        nlags = nlags)
image(x = v, y = v, z = lagged_autocov$Lag0)


# Example 2

N <- 500
v <- seq(from = 0, to = 1, length.out = 50)
sig <- 2
bbridge <- simulate_iid_brownian_bridge(N, v, sig)
nlags <- 10
lagged_autocov <- obtain_autocovariance(Y = bbridge,
                                        nlags = nlags)
image(x = v, y = v, z = lagged_autocov$Lag0)
image(x = v, y = v, z = lagged_autocov$Lag10)

# Example 3

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)
z_lims <- range(lagged_autocov$Lag0)
colors <- heat.colors(12)
opar <- par(no.readonly = TRUE)
par(mfrow = c(1,5))
par(oma=c( 0,0,0,6)) 
for(k in 0:nlags){
   image(x=v,
         y=v,
         z = lagged_autocov[[paste0("Lag",k)]],
         main = paste("Lag",k),
         col = colors,
         xlab = "u",
         ylab = "v")
}
par(oma=c( 0,0,0,2.5)) # reset margin to be much smaller.
image.plot( legend.only=TRUE, legend.width = 2,zlim=z_lims, col = colors)
par(opar)


[Package fdaACF version 1.0.0 Index]