Given a data frame like the one shown previously, we can use a multiple
regression method to obtain a model that predicts the value of the future returns
given the past observed returns. Before obtaining such models let us study some
properties of this data set.
(for instance the closing prices of a stock),
To create this function we have used the function diff(). This R function
calculates lagged differences of a vector, i.e. xt − xt−lag.
We will generate a data set using this function, which will then be used
to obtain a model to predict the future h-days returns of the closing price of
IBM stocks. The most common approach to obtain models for predicting the
future values of a time series variable is to use the most recent past values of the
series as the input variables of the model. Thus our model will try to predict
the h-days returns of the closing price of IBM stocks based on the most recent
values of these returns. This data preparation technique is usually known as
time delay embedding.
7