I found something slightly misleading in QuantileCutoffs.
I would like to compute the p99 of the income distribution, where p99 is a value such that Prob(Income>=p99) = 0.01 approximately.
I compute AllStats with simoptions.nquantiles=100. I intuitively assumed that
p99 = AllStats.Income.QuantileCutoffs(99)
but it turns out that this is the 98th percentile. So to pick the 99th percentile, I have to choose QuantileCutoffs(100). I find this slightly misleading.
Related: If I set simoptions.nquantiles=100, I would like to get p1,p2,..,p99 which are the 1st, 2nd,.., 99th percentiles of the distribution and p100 = max(Income). However, I instead get 101 values.
@robertdkirkby Just to make sure I understood things correctly, could you please confirm if this code is correct?
Params.p99 = AllStats2.Income.QuantileCutoffs(100);
Params.p97 = AllStats2.Income.QuantileCutoffs(98);
Params.p95 = AllStats2.Income.QuantileCutoffs(96);
Params.p90 = AllStats2.Income.QuantileCutoffs(91);
Instead, for the Lorenz curve, we apply the usual notation, right?
top1_wealth = 1 - AllStats.A.LorenzCurve(99);
Thanks in advance for the clarification!
Update
If my understand is correct, the following line from your replication of B2021 is also not correct:
Params.toponepercentincomecutoff=AllStats.Income.QuantileCutoffs(99)