GNARfit {GNAR}R Documentation

Fitting function for GNAR models

Description

Fits the GNAR model to the given inputs using GNARdesign and lm.

Usage

GNARfit(vts=GNAR::fiveVTS, net=GNAR::fiveNet, alphaOrder=2, betaOrder=c(1,1),
 fact.var=NULL, globalalpha=TRUE, tvnets=NULL, netsstart=NULL, ErrorIfNoNei=TRUE)

Arguments

vts

a matrix containing the multivariate time series to be modelled. The i,j entry of this matrix should be for time i and vertex/node j.

net

the (first) network associated with the time series, containing a list with entries $edges and $dist. This network should have the same number of nodes as the number of columns of the vts matrix.

alphaOrder

a non-negative integer specifying the maximum time-lag to model.

betaOrder

a vector of length alphaOrder specifying the maximum neighbour set to model at each of the time-lags.

fact.var

a vector of factors indicating which nodes belong to different sets with different parameters to be fitted.

globalalpha

a TRUE/FALSE value indivating whether to use global alpha parameters.

tvnets

a list of additional networks. Currently only NULL (the static network case) is supported.

netsstart

a vector of times corresponding to the first time points for each network of tvnets. Currently only NULL (the static network case) is supported.

ErrorIfNoNei

a TRUE/FALSE value indicating whether to stop the function call with an error if betaOrder specifies more neighbour sets than exist in the network. If FALSE the function will continue and some parameters will be NA.

Details

The GNAR model of order (p,S) is defined as

X_{i,t} = \sum_{j=1}^p \left( \alpha_{i,j} X_{i,t-j} +\sum_{c=1}^C \sum_{r=1}^{S_j} \beta_{j,r, c}\sum_{q \in {N}^{(r)}_t(i)} \omega_{i,q,c}^{(t)} X_{q,t-j} \right) + u_{i,t}

where p is the maximum time lag, S=(S_1,...,S_p) and S_j is the maximum stage of neighbour dependence for time lag j, {N}^{(r)}_t(i) is the rth stage neighbour set of node i at time t, \omega_{i,q,c}^{(t)} is the connection weight between node i and node q at time t if the path corresponds to covariate c. Here, we consider a sum from one to zero to be zero and \{u_{i,t}\}, are assumed to be independent and identically distributed at each node i, with mean zero and variance \sigma_i^2. Currently, only a single network GNAR model can be fitted. The connection weight, \omega_{i,q,c}^{(t)}, is the inverse of the distance between nodes i and q, normalised so that they sum to 1 for each i,t. See is.GNARnet for GNARnet object information and example construction.

Value

mod

the lm output from fitting the GNAR model.

y

the original response values, with NAs left in.

dd

the output of GNARdesign containing the design matrix, with NAs left in.

frbic

inputs to other GNAR functions.

References

Knight, M.I., Nunes, M.A. and Nason, G.P. Modelling, detrending and decorrelation of network time series. arXiv preprint.

Knight, M.I., Leeming, K., Nason, G.P. and Nunes, M. A. (2020) Generalised Network Autoregressive Processes and the GNAR package. Journal of Statistical Software, 96 (5), 1–36.

Examples

#Fit the GNAR(2,[1,1]) model to the fiveVTS data
GNARfit()

#Convert the residuals to matrix form
residToMat(GNARfit())$resid

[Package GNAR version 1.1.3 Index]