Is my understanding of the Gini plot to detect fat tails correct? I'm trying to reproduce the following plot:

which was generated on the Danish dataset of fire insurance claims using the ineq() function (a wrapper for functions that include calculating the Gini coefficient). This was found on this lecture and called 'concentration profile'.

a given sequence of truncated Gini indices, which we call
Concentration Profile (CP), can be used to characterize losses,
allowing (1) for the identification of parametric families of
distributions, and (2) for the observation of features that are not
immediately available from data, like the actual behavior of risk in
the tail.

The plot seems to say that the absolute distance between points as you progress to the tails doesn't drop until the end (where there are few data points left), and this invariance in the spread indicates fat tails - not sure about all this.
The code for the plot is
library('evir')
library('ineq')
data(danish)
sort_danish = sort(danish)
n=length(danish)
CP=c()
for (i in 1:n) CP[i]=ineq(sort_danish[i:n], type='Gini')

plot(1:n,CP,ylim=c(0,1),pch=19, cex=.3, col=rgb(0, 0, 100, max = 100, alpha = 50))

I would assume they use the formula in here for the Gini coefficient:
$$G=\frac{\sum_{i=1}^{n}\sum_{j=1}^n \vert x_i - x_j\vert}{2n^2\bar x}$$
This should be reproduced with:
library('evir')
data(danish)

v = sort(danish, decreasing = FALSE)

n = length(danish)

vec <- rep(0,n)
for (i in 1:n){
  mat <- matrix(0, n-i+1 , n-i+1)
  for (j in 1:(n-i+1)){
    mat[j,] <- abs(v[i+j-1] - v[i:n])
  }
  vec[i] <- sum(mat) / (2 * (n-i+1)^2 * mean(mat))
}

plot(vec)

if I interpret the Gini calculations properly, but it doesn't, leading me to believe I'm misunderstanding the plot.
 A: Mission accomplished, thanks to this post, which made me see clearly the silly mistake of dividing by the mean of the entire submatrix in the original question. Instead, the mean that is pertinent is of the segment of the tail under consideration in each iteration as in:
library('evir')
data(danish)

v = sort(danish, decreasing = FALSE)

n = length(danish)

CP <- rep(0,n)
for (i in 1:n){
  mat <- matrix(0, n-i+1 , n-i+1)
  for (j in 1:(n-i+1)){
    mat[j,] <- abs(v[i+j-1] - v[i:n])
  }
  CP[i] <- sum(mat) / (2 * (n-i+1)^2 * mean(v[i:n]))
}

plot(1:n,CP,ylim=c(0,1),pch=19, cex=.3, col=rgb(0, 0, 100, max = 100, alpha = 50))


The mechanics in the code can be appreciated by printing the sub-matrices in each iteration with a short random vector:
set.seed(0)

v = round(runif(3,2,35))
v
n = length(v)

CP <- rep(0,n)
for (i in 1:n){
  mat <- matrix(0, n-i+1 , n-i+1)
  for (j in 1:(n-i+1)){
    mat[j,] <- abs(v[i+j-1] - v[i:n])
    print(mat)
  }
  CP[i] <- sum(mat) / (2 * (n-i+1)^2 * mean(v[i:n]))
  print(CP)
}

with output:
     [,1] [,2] [,3]
[1,]    0   21   18
[2,]    0    0    0
[3,]    0    0    0
     [,1] [,2] [,3]
[1,]    0   21   18
[2,]   21    0    3
[3,]    0    0    0
     [,1] [,2] [,3]
[1,]    0   21   18
[2,]   21    0    3
[3,]   18    3    0
[1] 0.245614 0.000000 0.000000
     [,1] [,2]
[1,]    0    3
[2,]    0    0
     [,1] [,2]
[1,]    0    3
[2,]    3    0
[1] 0.245614 0.060000 0.000000
     [,1]
[1,]    0
[1] 0.245614 0.060000 0.000000

With respect to the Gini index, it seems like the idea is as expressed here:

Gini’s index equals half the mean [symbolized as $\langle \cdot \rangle$] absolute difference between two normalized and independent population-samples $W^1$ and $W^2.$
$$G = ⟨(W^1 − W^2)+⟩ =\frac 1 2 ⟨|W^1 − W^2|⟩,\tag {38}$$
where $W^1$ and $W^2$ are two i.i.d. copies of the normalized random variable $\hat W.$ Eq. (38) is an explicit stochastic formula for
Gini’s index $G$ — representing it in terms of the normalized random variable $\hat W.$

