2

I am using support vector regression in R to forecast future values for a uni-variate time series. Splitting the historical data into test and train sets, I find a model by using svm function in R to the test data and then use the predict() command with train data to predict values for the train set. We can then compute prediction errors. I wonder what happens then? we have a model and by checking the model on the train data, we see the model is efficient. How can I use this model to predict future values out of train data? Generally speaking, we use predict function in R and give it a forecast horizon (h=12) to predict 12 future values. Based on what I saw, the predict() command for SVM does not have such coomand and needs a train dataset. How should I build a train data set for predicting future data which is not in our historical data set?

Thanks

Fairy
  • 379
  • 1
  • 5
  • 17

2 Answers2

0

Just a stab in the dark... SVM is not for prediction but for classification, specifically supervised. I am guessing you are trying to predict stock values, no? How about classify your existing data, using some size of your choice say 100 values at a time, for noise (N), up (U), big up (UU), down (D), and big down (DD). In this way as your data comes in you slide your classification frame and get it to tell you if the upcoming trend is N, U, UU, D, DD.

Trey Gramann
  • 2,004
  • 20
  • 23
  • Thank you for your note. I have seen here (http://stackoverflow.com/questions/7782501/how-to-interpret-predict-result-of-svm-in-r) that I can use predict option to predict the value (or classification) of the test set. I wonder how can I do classification for data outside my historical data (future predictions or classifications). Is there any command to do that? – Fairy Apr 14 '15 at 12:29
0

What you can do is to build a data frame with columns representing the actual stock price and its n lagged values. And use it as a train set/test set (the actual value is the output and the previous values the explanatory variables). With this method you can do a 1-day (or whatever the granularity is) into the future forecast and then you can use your prediction to make another one and so on.

jeandut
  • 2,471
  • 4
  • 29
  • 56