Calculation of Gini Index
We will now calculate the Gini Index with the following -
Calculating the Gini Index for past trend
Calculating the Gini Index for open interest
Calculating the Gini Index for past trend
Since the past trend is positive 6 number of times out of 10 and negative 4 number
of times, the calculation will be as follows:
P(Past Trend=Positive): 6/10
P(Past Trend=Negative): 4/10
If (Past Trend = Positive & Return = Up), probability = 4/6
If (Past Trend = Positive & Return = Down), probability = 2/6
Gini Index = 1 - ((4/6)^2 + (2/6)^2) = 0.45
If (Past Trend = Negative & Return = Up), probability = 0
If (Past Trend = Negative & Return = Down), probability = 4/4
Gini Index = 1 - ((0)^2 + (4/4)^2) = 0
Weighted sum of the Gini Indices can be calculated as follows:
Gini Index for Past Trend = (6/10)0.45 + (4/10)0 = 0.27
Coming to open interest, the open interest is high 4 times and low 6 times out
of total 10 times and is calculated as follows:
P(Open Interest=High): 4/10
P(Open Interest=Low): 6/10
If (Open Interest = High & Return = Up), probability = 2/4
If (Open Interest = High & Return = Down), probability = 2/4
Gini Index = 1 - ((2/4)^2 + (2/4)^2) = 0.5
If (Open Interest = Low & Return = Up), probability = 2/6
If (Open Interest = Low & Return = Down), probability = 4/6
Gini Index = 1 - ((2/6)^2 + (4/6)^2) = 0.45
Weighted sum of the Gini Indices can be calculated as follows:
Gini Index for Open Interest = (4/10)0.5 + (6/10)0.45 = 0.47
Calculating the Gini Index for trading volume
Trading volume is 7 times high and 3 times low and is calculated as follows:
P(Trading Volume=High): 7/10
P(Trading Volume=Low): 3/10
If (Trading Volume = High & Return = Up), probability = 4/7
If (Trading Volume = High & Return = Down), probability = 3/7
Gini Index = 1 - ((4/7)^2 + (3/7)^2) = 0.49
If (Trading Volume = Low & Return = Up), probability = 0
If (Trading Volume = Low & Return = Down), probability = 3/3
Gini Index = 1 - ((0)^2 + (1)^2) = 0
Weighted sum of the Gini Indices can be calculated as follows:
Gini Index for Trading Volume = (7/10)0.49 + (3/10)0 = 0.34
Calculating Gini Index of open interest for positive past trend
Open interest for positive past trend is high 2 times out of 6 and low 4 times out of
6 and the Gini Index of open interest for positive past trend is calculated as
follows:
P(Open Interest=High): 2/6 P(Open Interest=Low): 4/6
If (Open Interest = High & Return = Up), probability = 2/2
If (Open Interest = High & Return = Down), probability = 0
Gini Index = 1 - (sq(2/2) + sq(0)) = 0
If (Open Interest = Low & Return = Up), probability = 2/4
If (Open Interest = Low & Return = Down), probability = 2/4
Gini Index = 1 - (sq(0) + sq(2/4)) = 0.50
Weighted sum of the Gini Indices can be calculated as follows:
Gini Index for Open Interest = (2/6)0 + (4/6)0.50 = 0.33
Calculating Gini Index for trading volume
The trading volume is high 4 out of 6 times and low 2 out of 6 times and is
calculated as follows:
P(Trading Volume=High): 4/6P(Trading Volume=Low): 2/6
If (Trading Volume = High & Return = Up), probability = 4/4
If (Trading Volume = High & Return = Down), probability = 0
Gini Index = 1 - (sq(4/4) + sq(0)) = 0
If (Trading Volume = Low & Return = Up), probability = 0
If (Trading Volume = Low & Return = Down), probability = 2/2
Gini Index = 1 - (sq(0) + sq(2/2)) = 0
Weighted sum of the Gini Indices can be calculated as follows:
Gini Index for Trading Volume = (4/6)0 + (2/6)0 = 0