GNARXdesign: Function to create the GNARX design matrix

GNARXdesignR Documentation

Function to create the GNARX design matrix

Description

Creates the design matrix necessary for fitting the GNAR model.

Usage

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

Arguments

vts

a matrix or ts object 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 each set 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.

lambdaOrder

a vector of the same length as xvts containing non-negative integers specifying the maximum time-lag of exogenous regressors to model. The hth element of the vector refers to the maximum lag of the hth exogenous regressor.

xvts

a list of matrices containing values of the exogenous regressors for each vertex/node. The i,j entry of the hth element of the list refers to the value of the hth exogenous regressor for time i and vertex/node j.

Value

GNARdesign

returns a matrix containing (t-alphaOrder)nnodes rows and a column for each parameter to be fitted. The columns are in time-lag order, eg for GNAR(2,[1,0]) the columns are alpha1, beta1.1, alpha2. When a factor variable is specified the columns are labelled with the factor. If exogenous regressors are included, the matrix takes the form given in Equation 10 of the supplement to the referenced paper.

References

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)

#Design matrix to fit GNARX(2,[1,1]) to the fiveVTS data

Xdesign <- GNARXdesign(vts = Y_data, net = GNAR::fiveNet, globalalpha = TRUE, alphaOrder = 1,
                betaOrder = 1, xvts = xvts, lambdaOrder = c(1,1))

Xdesign

GNAR documentation built on April 28, 2023, 1:12 a.m.

Related to GNARXdesign in GNAR...