data preparation and format for NARX
Show older comments
Hello everybody,
I am trying to use arx in order to predict the stock price movement a day ahead.
I have two vectors: dailyReturns that contain returns of each day. the first index of the vector contains the return of the closest date (ex: today) and the last index of the vector contains the return of the latest date (ex: two years ago).
****************************************
Here are the vectors:
DailyReturns = [return(day1) return(day2) return(day3) ... return(dayN)];
positive=find(DailyReturns>0); spotTrend(positive)=1;
negative=find(DailyReturns<0); spotTrend(negative)=(-1);
spotTrend is something like that = [-1 1 1 1 -1 1 -1 -1 ...]
moreover the size of the two vectors are identical.
******************************************
So let say I would like to use ARX: input data is DailyReturns. target data is spotTrend.
The questions are the following:
1- can I use directly these two vectors for ARX. or do I have to shift my target data so that the index number 1 of input vector is linked to the index number 2 of target vector (because I want to predict the sign of the return a day ahead).
2- my input data must be in an increasing temporal order or a decreasing temporal order? Does it matter? i.e do I have to feed my neural networks with DailyReturns = [return(dayN) return(day N-1) return(dayN-2) ... return(day 1)];
or like this
DailyReturns = [return(day1) return(day2) return(day3) ... return(dayN)];
thank you a lot for your answer. I do not find a matlab tutorial of how to prepare the data for nnet.
thanks
Accepted Answer
More Answers (4)
Shashank Prasanna
on 3 Feb 2013
0 votes
PREPARETS will do it for you:
Take look at the NARX example below.
Greg Heath
on 4 Feb 2013
0 votes
I don't think your approach will work anywhere near as well as one that defines a trend in terms of a positive or negative slope over a specified time interval.
In addition, you should be looking for relative (e.g., %) changes in value, not the values themselves.
Hope this helps.
Greg
allline
on 6 Feb 2013
Greg Heath
on 7 Feb 2013
0 votes
I think you are making the problem more complicated than it is. Price is always positive. So what does
negative=find(DailyReturns<0); spotTrend(negative)=1;
mean? if return ~= price, then how is it defined?
You only have one series. Therfore you can use narnet, not narxnet to predict future values, future changes in value, or future changes in relative value.
If you cannot understand the preparets documentation, run the narx (not nar) example with ending semicolons omitted. Then type
whos
to understand how input dimensions are changed.
If you still don't understand, post your preparets questions with explanatory excerpts of your code and results.
Hope this helps.
Greg
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!