Learn R Programming

GNAR (version 0.2.9)

GNARpredict: Fits and predicts using the GNAR model

Description

Fits the GNAR model to up to observation t-1 and produces a within-sample prediction for time t.

Usage

GNARpredict(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 differents 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.

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.

Value

pred

the prediction for time t.

mod

the lm output from fitting the GNAR model up to t-1.

ys

the original response values up to t-1, with NAs left in.

ds

the output of GNARdesign containing the design matrix up to t-1, with NAs left in.

ypred

the original response values at t.

dpred

the time t entries of the design matrix.

frbic

inputs to the GNARpredict function.

Details

See GNARfit for GNAR model information. Note that the prediction is for the final time observation of the input data, to predict out-of-sample add a row of zeros to the input data matrix. Only coefficients with p-value smaller than 0.05 are used to calculate prediction. See is.GNARnet for GNARnet object information and example construction.

Examples

Run this code
# NOT RUN {
#Fit and predict the fiveVTS data with the GNAR(2,[1,1]) model
data(fiveNode)
GNARpredict()
# }

Run the code above in your browser using DataLab