I'm currently working on SVR to predict stock market returns and I would like to know if anyone of you could give me some advise regarding interesting papers on it.
These are the articles I'm working with:
- Cao, L., Tay, F.E.H. (2001). Financial forecasting using support vector machines. Neural Computing and Applications, 10:184-192.
- Wang,L., Zhu, J. (2010). Financial market forecasting using a two-step kernel
learning method for the support vector regression. Annals of Operations Research, 174:103-120. [DOI]
The second paper is really interesting but quite hard to put into practise as the author is using a two-step kernel learning method to find the optimal kernel function for the SVR. All the papers I found does not provide many details about tuning parameters (C and sigma for the Gaussian kernel).
I'm using R for my computations (Kernlab
and e 1071
packages).
Best Answer
Correctly tuning
C
andsigma
is of course essential to getting good forecasts. It looks like what the authors of the second paper are doing is a time-series cross-validation, where they are selectingC
andsigma
using a training set at each cross-validation step. I've written some R code for cross-validating generic time-series forecasting functions, which might help solve this problem. Lets try to replicate the plain SVR method of Wang,L., Zhu, J. (2010). First we load the data and build the moving averages referenced in the paper:Note that we've loaded the
cv.ts
function from my github repository. Next we define the SVR forecast function, following the method described in the paper of fitting the SVM to 150 observations, tuning the kernel parameters on the next 10 observations, and then re-fitting the SVM to observations 11:160:Next we define the cross-validation parametersm using the
tseriesControl
function from the github repo:We require 160 observations to fit the model at each step (150 for training, 10 for tuning the kernel), and after forecasting at each point in time we forecast out 10 periods (maxHorizon) and then step forward 10 periods to the next forecasting point.
After defining the prediction function and the cross validation method we wish to use, it's easy to run the cross validation:
The cv.ts function makes use of the
foreach
package, so you can register a parallel backend if you wish, to speed up the cross-validation. The cross-validation function outputs a matrix where the rows are the points in time at which the model was fit, and the columns are the 1-10 day forecasts from that point in time:As you can see from the table and the equity curve, the SVR strategy I've defined is terrible.
I can see 2 possible reasons why this may be: