GNARXdesign {GNAR} | R 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 |
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 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 |
lambdaOrder |
a vector of the same length as |
xvts |
a list of matrices containing values of the exogenous regressors for each vertex/node. The |
Value
GNARdesign |
returns a matrix containing |
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