GNARXfit {GNAR} | R Documentation |
Fitting function for GNARX models
Description
Fits the GNARX model to the given inputs using GNARdesignX
and lm
.
Usage
GNARXfit(vts=GNAR::fiveVTS, net=GNAR::fiveNet, alphaOrder=2, betaOrder=c(1,1),
fact.var=NULL, globalalpha=TRUE, tvnets=NULL, netsstart=NULL, ErrorIfNoNei=TRUE,
xvts=NULL, lambdaOrder=NULL)
Arguments
vts |
a matrix containing the multivariate time series to be modelled. The |
net |
the (first) network associated with the time series, containing a list with entries |
alphaOrder |
a non-negative integer specifying the maximum time-lag to model. |
betaOrder |
a vector of length |
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 |
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. |
xvts |
a list of matrices containing values of the exogenous regressors for each vertex/node. The |
lambdaOrder |
a vector of the same length as |
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 r
th 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.
A GNARX process of order p
, neighbourhood order vector s
of length p
and H
node-specific time series exogenous variables with order vector p'
, denoted
GNARX (p, s, p')
, is given by
Y_{i,t}=\sum_{j=1}^{p}\left(\alpha_{i,j}Y_{i,t-j} + \sum_{r=1}^{s_j} \beta_{j,r} \sum_{q\in\mathcal{N}^{(r)}(i)}\omega_{i,q}Y_{q,t-j}\right)+ {\color{blue} \sum_{h=1}^H
\sum_{j'=0}^{p'_h}
\lambda_{h,j'} X_{h,i,t-j'}+u_{i,t}},
where u_{i, t}
are assumed to be set of mutually uncorrelated random variables with
mean zero and variance of \sigma^2
.
Value
mod |
the |
y |
the original response values, with NAs left in. |
dd |
the output of |
frbic |
inputs to other |
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.
Nason G.P. and Wei J. (2022) Quantifying the economic response to COVID-19 mitigations and death rates via forecasting Purchasing Managers’ Indices using Generalised Network Autoregressive models with
exogenous variables. Journal of the Royal Statistical Society Series A, 185, 1778–1792.
Examples
set.seed(1)
n = 1000
xvts=list()
xvts[[1]] = matrix(rnorm(5*n, mean=0, sd=2), nrow=n, ncol=5)
xvts[[2]] = matrix(rnorm(5*n, mean=0, sd=2), nrow=n, ncol=5)
lambdaParams=list()
lambdaParams[[1]] = c(0.5, -0.5)
lambdaParams[[2]] = c(0.3, 0.1)
# Simulate the GNARX using the exogenous variables xvts with associated parameters lambdaParams
Y_data <- GNARXsim(n=n, net=GNAR::fiveNet, alphaParams=list(c(rep(0.2,5))), betaParams=list(c(0.5)),
sigma=1, xvts=xvts, lambdaParams=lambdaParams)
# fit a GNARX to the model
model <- GNARXfit(vts = Y_data, net = GNAR::fiveNet,globalalpha = TRUE, alphaOrder = 1,
betaOrder = 1, xvts = xvts, lambdaOrder = c(1,1))
# look at the residuals
residToMat(model)$resid