Learn R Programming

GNAR (version 1.1.4)

corbit_plot: Corbit (correlation-orbit) plot, which aids model selection by visualising network autocorrelation and partial network autocorrelation.

Description

Plots the GNAR network autcorrelation funciton for a choice of maximum lag and maximum r-stage depth in the network. Using the nacf function for network autocorrelation and pnacf for partial network autocorrelation.

Usage

corbit_plot(vts, net, max_lag, max_stage, weight_matrix, 
viridis_color_option="viridis", size_option="absolute_val", 
partial="no", r_corbit="no", line_segment="no", rectangular_plot="no")

Value

Produces the specified, i.e, NACF or PNACF for a choice of lag and \(r\)-stage depth, \((h, r)\), Corbit plot. Does not print (P)NACF values, these are stored as an invisble data frame (matrix), and can be accessed by printing or calling the object produced by the corbit_plot call.

Arguments

vts

Vector time series observations for which one wishes to plot the network autocorrelation or partial network autocorrelation.

net

GNAR network object linked to the time series under study.

max_lag

Maximum lag the Corbit plot produces (i.e., number of time-steps considered for the network autocorrelaiton.)

max_stage

Maximum r-stage depth considered for the Corbit plot (i.e., the number of rings in the plot). Corresponds to the length of paths in the underlying network.

weight_matrix

A matrix which entries correspond to the weights between nodes. If this term is NULL, then this argument is equal weights between r-stage neighbours.

viridis_color_option

Colour scale for the Corbit plot. The default option is viridis, each option is colout blind friendly; see viridis package.

size_option

Point size scale for the Corbit plot. The 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 with fixed lag and stage.

partial

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

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 r_corbit_plot.

line_segment

Default is set to no (i.e., line_segment = "no"). Changing the option to yes produces an alternative Corbit plot with a line segment between the first and last lags.

rectangular_plot

Option for producing alternative rectangular plots. Default is set to no (i.e., rectangular_plot = "no"). Changing it to yes (i.e., rectangular_plot = "yes") produces a rectangular plot with (P)NACF values on the y-axis and lags on the x-axis, r-stages are distinguished by colour. Changing it to square (i.e., rectangular_plot = "square") produces a square plot with r-stages on the y-axis and lags on the x-axis.

Author

Daniel Salnikov and Guy Nason.

Details

This function computes network autocorrelation or partial network autocorrelation function values for a specific choice of maximum lag and r-stage depth, and produces the corresponing Corbit plot. Each point in a Corbit plot corresponds to the (P)NACF value, i.e., (p)nacf(h, r), at a h-lag and r-stage pair. The ring number starting from the inside corresponds to r-stage depth (path length), and the numbers on the outside ring indicate time lag. The colour scale is based on the overall network autocorrelation values (i.e., the colour is set to highlight strong correlations). The dot at the centre has (p)nacf(h, r)=0 and the smallest size for aiding comparison. Please see the RMarkdown document mentioned in GNAR references for plot examples.

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
#
# Simulate 100 observations from a stationary GNAR(2, [2, 1]), where 
# fiveNet is the underlying network.
# 
gnar_simulation <- GNARsim(n = 100, net=fiveNet, alphaParams = list(rep(0.25, 5), rep(0.12, 5)), 
        betaParams = list(c(0.25, 0.13), c(0.20)), sigma=1)
# We produce the corresponding Corbit plots.
corbit_plot(gnar_simulation, fiveNet, 20, 3)
corbit_plot(gnar_simulation, fiveNet, 20, 3, partial = "yes")

# If the network object comes with its own weights, then these can be added by including 
# the option weight_matrix in the corbit call.
# corbit_plot(vts, net, max_lag, max_stage, weight_matrix = object_weights_matrix)

Run the code above in your browser using DataLab