I made some adjustments to the md_quantile_welfare_share function. There were two issues
While the function was accounting for weights in calculating the quantile values, when finding the sum of welfare within those quantiles, it did not use weights. Lines 265-272 now include the weights
When n=NULL and the popshare argument is used, the result was a vector of length 2, rather than length 1. This is because if, for example, popshare = 0.7 then the first element in the vector gave the welfare share below 0.7 and then the second element gave the share above 0.7 (which is the functionality we want when using n). The change is to only give the first element when popshare is used.
Hi @randrescastaneda ,
I made some adjustments to the
md_quantile_welfare_share
function. There were two issuesn=NULL
and thepopshare
argument is used, the result was a vector of length 2, rather than length 1. This is because if, for example,popshare = 0.7
then the first element in the vector gave the welfare share below 0.7 and then the second element gave the share above 0.7 (which is the functionality we want when usingn
). The change is to only give the first element whenpopshare
is used.