How to compute entropy?

Joined
6/28/13
Messages
6
Points
11
Hi all,

I am new here, just registered: I would like to code in Java the Shannon entropy for financial time series but the process to follow it is not fully clear to me: for what I have seen so far it seems that entropy is computed on log diff, then 3 different states are defined (return higher, lower or neutral). I wonder if there is someone so kind to explain the logic, i.e. the steps I have to accomplish.

Thanks all
 
the logic is real simple ...Entropy can be computed as p*log P ..Now p is the probability of the histogram bin. Histogram bin can be defined by your choice. There are standard ways of doing that..I am sure you will find it on net
 
Well, let's do a practical example:

1) take log diff of the original serie

2) suppose we create 5 bins so that:
-2 : return <= -2,5%
-1 : return <= -0.5% > -2.5%
0 : return > -0.5% <+0.5%
+1 : return > +0.5% < +2.5%
+2 : return >= +2.5%

3) ???
 
4. Now compute the frequency in each bin... Assuming you have sufficient sample size

5. Compute p*log in each bin

6. Sum the intermediate p*logp value and you will get the entropy of the series

7. If you want your analysis more robust you can do bootstrapping and and compute this entry of every sub-sample and take average..However it depends what analysis you are doing
 
Hi Kumarab, one more question: in your opinion, how do I have to do to come to a Shannon entropy plot such as the image below?

Z027.webp


Where red line is the Nasdaq time serie and blue line is the Shannon entropy.

Thank you very much.

Alberto
 
The process that I have explained you can be very much applied to this chart as well. You can fix your data window(lets say 250 data points if you are using daily data charts). For every new day you will add and new sample point and delete the oldest sample point and conduct the analysis as per the previous post.
 
Thank you very much for the link you provide, attached is a .txt daily data serie: can you please try to compute the entropy (shannon or / and any other you prefer) on this serie such as the picture on my previous reply? I will code it in Java but any other language is good, so C, C++ etc.

Your help is really very very much appreciated.

Best regards,

Alberto

PS .txt data is in standard format,

Date, Open, High, Low, Close, Volume
 

Attachments

Alberto,

I can do the coding for you but you have to confirm one thing first. Is this part of some assignment of yours. If it is then I will not be doing this work.

Thanks and regards,

Abhishek Kumar
 
Hi Abhishek

this is not part of any asssigment. Absolutely . I am doing my own researches for time series predictability and it seems entropy analysis could be useful

I am working at cycle analysis and forecast. For more info I am on skype with my nick and also for mail @google.com

Thank you very much

With my best regards

Alberto
 
Back
Top Bottom