Learn R Programming

GNAR (version 1.1.4)

r_corbit_plot: Produces a R-Corbit plot for the specified choice of covariate-levels and/or time-slices.

Description

Produces a R-Corbit plot for comparing the network autocorrelation (NACF) and partial network autocorrelation function (PNACF) values for a choice of maximum lag and maximum \(r\)-stage depth. Starting from the first and continuing to the outermost ring, each ring corresponds to said choice of \(r\)-stage depth. The numbers on the outermost ring are time-lags, and each dot corresponds to a specific time-slice or covariate-level.

Usage

r_corbit_plot(vts_frames, network_list, max_lag, max_stage, weight_matrices, 
frame_names, same_net="no", viridis_color_option="viridis", size_option="absolute_val", 
partial="no", r_corbit="yes")

Value

Produces the specified, i.e., NACF or PNACF, values for a choice of lag and \(r\)-stage depth, \((h, r)\), R-Corbit plot. Does not print (P)NACF values, these are stored as invisble data frames (matrices), and can be accessed by printing or calling the object produced by the r_corbit_plot call. The invisible object is a list of matrices, one matrix for each covariate-level/time-slice.

Arguments

vts_frames

List containing the vector time series linked to each of the covariate-levels and/or time-slices, which the R-Corbit plot compares.

network_list

List of network objects for which the R-Corbit plot compares network autocorrelation or partial network autocorrelation.

max_lag

Maximum lag for the R-Corbit plot.

max_stage

Maximum \(r\)-stage depth for the R-Corbit plot (i.e., the number of rings in the R-Corbit plot).

weight_matrices

List of weigth matrices, each weight matrix corresponds to a particular choice of time-slice or covariate-level. If all the time-slices have the same weight matrix, then the argument is a list, where all the entries are equal to the unique weight matrix.

frame_names

Indicates the name of each time-slice or covariate-level time series. Order should be the same as in the weight matrices and vector time series lists.

same_net

Indicates whether or not all time-slices or covariate-levels share the same weight matrix. Default choice is no, if the time-slices or covariate-levels share the same weight matrix, then this argument should be set to "yes" (i.e., same_net = "yes").

viridis_color_option

Colour scale for the R-Corbit plot. The default option is viridis, each option is colout blind friendly.

size_option

Point size scale for the R-Corbit plot. Default is the absolute value of the network autocorrelation function (i.e., |nacf(h, r)| or |pnacf(h, r)|). Alternate option is the coefficient of determination coming from a global-\(\alpha\) model constrained to a specific lag and stage pair.

partial

Option for selecting between computing the network autocorrelation function or the partial network autocorrelation function. Default choice is network autocorrelation (i.e., partial="no"). Change argument to "yes" for computing the partial network autocorrelation function (PNACF).

r_corbit

Choice for distinguishing between Corbit and R-Corbit plots, default is set to Corbit (inner function call). For producing R-Corbit plots one should use corbit_plot.

Author

Guy Nason and Daniel Salnikov

Details

R-Corbit plots compare the network autocorrelation function (NACF) and partial network autocorrelation function (PNACF) values for a choice of different time-slices and/or covariate-levels. R-Corbit plots are read in the same manner as Corbit plots corbit_plot, and include a legend on the right-hand side for distinguishing between covariate-levels and/or time-slices. The point at the centre is the mean value of the NACF or PNACF values arising from the time-slices and/or covariate-levels data splits. Essentially, if \(c \in \{1, \dots, C\}\), where \(C \in \mathbb{N}\) is the number of covariate-levels or time-slices, then the value at the centre is \(\mathrm{(p)nacf}(h, r) = C^{-1} \sum_{c = 1}^{C} \mathrm{(p)nacf}_c (h, r),\) where \(\mathrm{(p)nacf}_c(h, r)\) is the (P)NACF value corresponding to the covariate-level/time-slice \(c\). The number of covariate-levels and time-slices \(C\) must be equal to the length of the lists used for producing the R-Corbit plot.

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

if (FALSE) {
#
# Produces a R-Corbit plot, which compares three stationary GNAR simulations, where 
# the underlying network is fiveNet.
#
# Compute the weight matrix
W = weights_matrix(fiveNet)
#
# Simulate three stationary GNAR processe
sim1 <-  GNARsim(n = 100, net=fiveNet, alphaParams = list(c(0.1, 0.12, 0.16, 0.075, 0.21),
                                                          c(0.12, 0.14, 0.15, 0.6, 0.22)), 
                 betaParams = list(c(0.1, 0.16), c(0.11, 0.14)))

sim2 <-  GNARsim(n = 100, net=fiveNet, alphaParams = list(rep(.25, 5)), 
                 betaParams = list(c(0.1, 0.16)))

sim3 <- GNARsim(n = 100, net=fiveNet, alphaParams = list(rep(.25, 5), rep(0.13, 5)), 
                betaParams = list(c(0.1, 0.16), c(0.11)))
                
# Produce NACF R-Corbit plot with the same network and weights matrix
r_corbit_plot(list(sim1, sim2, sim3), list(fiveNet), 10, 3, list(W), 
		c("sim1", "sim2", "sim3"), same_net = "yes")
# 
# Produce PNACF R-Corbit with different networks and weight matrices
print(r_corbit_plot(list(sim1, sim2, sim3), list(fiveNet, fiveNet, fiveNet), 10, 3, list(W, W, W),
		 c("sim1", "sim2", "sim3"), same_net = "no", partial = "yes"))

}

Run the code above in your browser using DataLab