Learn R Programming

GNAR (version 1.1.4)

pnacf: Computes the Partial Network Autocorrelation Function (PNACF)

Description

Computes the PNACF for a choice of lag \(h\) and r-stage depth \(r\), the PNACF is given by \( \mathrm{pnacf}(h, r) = \frac{\sum_{t=1}^{T - h} ( \boldsymbol{\hat{u}}_{t + h} - \boldsymbol{\overline{u}})^{T} \big ( \mathbf{W} \odot \mathbf{S}_r + \mathbf{I_d} \big ) ( \boldsymbol{\hat{u}}_{t} - \boldsymbol{\overline{u}})} {\sum_{t=1}^{T} ( \boldsymbol{\hat{u}}_{t} - \boldsymbol{\overline{u}})^{T} \big \{ \big (1 + \lambda \big) \mathbf{I_d} \big \} ( \boldsymbol{\hat{u}}_{t} - \boldsymbol{\overline{u}})}, \) where \(\hat{\boldsymbol{X}}_{t}^{h - 1, r - 1} = \sum_{k = 1}^{h - 1} ( \hat{\alpha}_k \boldsymbol{X}_{t - k} + \sum_{s = 1}^{r - 1} \hat{\beta}_{ks} \boldsymbol{Z}_{t - k}^{s} )\), \(\boldsymbol{\hat{u}}_{t + h} = \boldsymbol{X}_{t + h} - \hat{\boldsymbol{X}}_{t + h}^{h - 1, r - 1}\), and \(\boldsymbol{\hat{u}}_{t} = \boldsymbol{X}_{t} - \hat{\boldsymbol{X}}_{t}^{h - 1, r - 1}\) are the empirical residuals corresponding to GNAR(h -1, [r-1, ..., r - 1]) fits, \(\lambda\) is the same as for the NACF; see nacf, and \(\boldsymbol{\overline{u}}\) is the mean of the fitted residuals

Usage

pnacf(h, s,  weight_matrix, stages_tensor, nts_data)

Value

If the network time series contains missing values, then the weights matrix and \(\lambda\) are adjusted, so that missing values do not contribute to the partial network autocorrelation. This is done by setting to zero the weights which correspond to a missing value and computing the new weight matrix and \(\lambda\) value.

Arguments

h

Lag (i.e., time-steps behind) at which the NACF is computed.

s

r-stage depth at which the NACF is computed (i.e., shortest distance between nodes).

weight_matrix

Weight matrix of the GNAR process, each entry corresponds to the weight between two nodes; see weights_matrix

stages_tensor

List of r-stage adjacency matrices \(\mathbf{S}_r\), the order is ascending.

nts_data

Network time series observations, the number of rows is equal to the number of time steps, and the number of columns is equal to the number of series (variables).

Author

Daniel Salnikov and Guy Nason

References

Nason, G.P., Salnikov, D. and Cortina-Borja, M. (2023) New tools for network time series with an application to COVID-19 hospitalisations. https://arxiv.org/abs/2312.00530

Examples

Run this code
#
# Compute the PNACF with respect to a stationary GNAR simulation
#
gnar_simulation <- GNARsim(n = 100, net=fiveNet, alphaParams = list(rep(0.35, 5)), 
                           betaParams = list(c(0.25)), sigma=1)
W = weights_matrix(fiveNet)
stages_list = get_k_stages_adjacency_tensor(as.matrix(GNARtoigraph(fiveNet)), 3)
# PNACF
pnacf(3, 1, W, stages_list, gnar_simulation)

Run the code above in your browser using DataLab