recursive_hstep_slow {pretest} | R Documentation |
Forecasting h-steps ahead using Recursive Least Squares Slow
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,. . . ). It calculates the recursive residuals starting from the first (n * pi0) data points, where n is the total number of data points.
Usage
recursive_hstep_slow(y, x, pi0, h)
Arguments
y |
n x 1 Outcome series, which should be numeric and one dimensional. |
x |
n x p 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
Author(s)
Rong Peng, r.peng@soton.ac.uk
Examples
x<- rnorm(15);
y<- x+rnorm(15);
temp2 <- recursive_hstep_slow(y,x,pi0=0.5,h=1);