Learn R Programming

forecastSNSTS (version 1.3-0)

computeMSPEcpp: Mean Squared Prediction Errors, for a single \(h\)

Description

This function computes the estimated mean squared prediction errors from a given time series and prediction coefficients

Arguments

X

the data

coef

the array of coefficients.

h

which lead time to compute the MSPE for

t

a vector of times from which backward the forecasts are computed

type

indicating what type of measure of accuracy is to be computed; 1: mspe, 2: msae

trimLo

percentage of lower observations to be trimmed away

trimUp

percentage of upper observations to be trimmed away

Value

Returns a P x length(N) matrix with the results.

Details

The array of prediction coefficients coef is expected to be of dimension P x P x H x length(N) x length(t) and in the format as it is returned by the function predCoef. More precisely, for \(p=1,\ldots,P\) and the j.Nth element of N element of N the coefficient of the h-step ahead predictor for \(X_{i+h}\) which is computed from the observations \(X_i, \ldots, X_{i-p+1}\) has to be available via coef[p, 1:p, h, j.N, t==i].

Note that t have to be the indices corresponding to the coefficients.

The resulting mean squared prediction error $$\frac{1}{|\mathcal{T}|} \sum_{t \in \mathcal{T}} (X_{t+h} - (X_t, \ldots, X_{t-p+1}) \hat v_{N[j.N],T}^{(p,h)}(t))^2$$ is then stored in the resulting matrix at position (p, j.N).