data preparation and format for NARX
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Akzeptierte Antwort
Greg Heath
am 5 Feb. 2013
Vector indices increase with time. Plot the target series
t(i) = (price(i)-price(i-1))/price(i-1) % Relative price change for i>=2
Calculate the autocorrelation function and determine the statistically significant lags
You have decided to predict 1 day ahead.
Look at the sig lags of the acf to determine how many delays (= No. of past day prices) to use in narnet.
help narnet
doc narnet
help preparets
doc preparets
help configure
doc configure
help nndata %Find more data and demos for narnet
When you run the examples in the documentation, remove the ending semicolons so that you can understand what each command does.
Also search the NEWSGROUP and ANSWERS posts separately using those three as search words.
Use as many defaults as possible. However, Do not use the default divideFcn = 'dividerand'. It destroys correlations . I prefer 'divideblock'.
Hope this helps.
Thank you for formally accepting my answer.
Greg
0 Kommentare
Weitere Antworten (4)
Greg Heath
am 4 Feb. 2013
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
Greg Heath
am 7 Feb. 2013
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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!