recursive_hstep_fast {EncompassTest}R Documentation

Forecasting h-steps ahead using Recursive Least Squares Fast

Description

Consider the following LS-fitted Model with intercept: y_(t+h) = beta_0 + x_t * beta + u_(t+h) which is used to generate out-of-sample forecasts of y, h-steps ahead (h=1,2,3,. . . ). Notes: (1) first estimation window is (1,...,k0) and last window is (1,....,n-h) for k0 = round(n*pi0). First forecast is yhat(k0+h|k0) and last forecast is yhat(n|n-h). There are a total of (n-h-k0+1) forecasts and corresponding forecast errors. (2) this fast version of the recursive least squares algorithm uses the Sherman-Morrison matrix formula to avoid matrix inversions at each recursion.

Usage

recursive_hstep_fast(y, x, pi0, h)

Arguments

y

an outcome series, which should be numeric and one dimensional.

x

a predictor matrix (intercept would be added automatically).

pi0

Fraction of the sample, which should be within 0 and 1.

h

Number of steps ahead to predict, which should be a positive integer.

Details

recursive_hstep_fast is the fast version that avoids the recursive calculation of inverse of the matrix using Sherman-Morrison formula. recursive_hstep_slow is the slow version that calculates the standard OLS recursively.

Value

Series of residuals estimated

Examples

x<- rnorm(15);
y<- x+rnorm(15);
temp1 <- recursive_hstep_fast(y,x,pi0=0.5,h=1);

[Package EncompassTest version 0.22 Index]