The idea of "auto-capping" where anyone who gets above one standard deviation (bell curve distribution) stops getting basic income

in #res-currency6 years ago (edited)

The idea of "auto-capping", where anyone who gets above one standard deviation (bell curve distribution) stops getting basic income, and between that exponentially less from mean to one standard deviation. The "auto-capping" finds an average basic income amount without a hard-coded cap.

struct BellCurve {
    uint population;
    uint total;
    uint mean;
    uint standardDeviation;
    mapping(address => uint) basicincome;
    mapping(address => uint) differences;
    uint differences_squared_sum;
    uint variance;
    mapping(address => uint) sigma;
}



// calculateMean() can be called after some period of time, say, 7 days, 
// so there is time to process the swarm redistribution pulse first

function calculateMean(bytes32 _taxID) {
  require(taxRecord[_taxID].timestamp + 7 days < now);
  require(taxRecord[_taxID].bellcurve.mean == 0);
  taxRecord[_taxID].bellcurve.mean = taxRecord[_taxID].bellcurve.total / taxRecord[_taxID].bellcurve.population;
}

function calculateDifference(address _node, bytes32 _taxID) {
  require(taxRecord[_taxID].bellcurve.variance == 0);
  uint mean = taxRecord[_taxID].bellcurve.mean;
  require(mean != 0); // Has the mean been calculated first?
  uint basicincome = taxRecord[_taxID].bellcurve.basicincome[_node];
  require(basicincome != 0); // Is the person in the tax record?
  require(taxRecord[_taxID].bellcurve.differences[_node] == 0); // Has this person been processed already?
  uint difference = mean - basicincome;
  taxRecord[_taxID].bellcurve.differences[_node] = difference;
  taxRecord[_taxID].bellcurve.differences_squared_sum += difference^2;
}

function calculateVariance(bytes32 _taxID) {
  require(taxRecord[_taxID].timestamp + 10 days < now); // Allow 3 days to process calculateDifference()
  uint variance = taxRecord[_taxID].bellcurve.differences_squared_sum / taxRecord[_taxID].bellcurve.population;
  taxRecord[_taxID].bellcurve.variance = variance;
}

function  calculateStandardDeviation(bytes32 _taxID) {
    uint variance = taxRecord[_taxID].bellcurve.variance;
    require(variance != 0);
    taxRecord[_taxID].bellcurve.standardDeviation = sqrt(taxRecord[_taxID].bellcurve.variance);
}

function sqrt(uint x) returns (uint y) {
    uint z = (x + 1) / 2;
    y = x;
    while (z < y) {
        y = z;
        z = (x / z + z) / 2;
    }
}


Then when calculating the ratio a person gets from a pulse, both the distance from the origin of the pulse, as well as the bell curve to "cap" the amount, are used,

calculateRatio(address _node, bytes32 _taxID) {
  require(taxRecord[_taxID].bellcurve.standardDeviation != 0);
  require(taxRecord[_taxID].distance[_node] != 0 && taxRecord[_taxID].distance[_node] < 10);

  uint ratio = 1 − (_distance/10)^2;

  // multiply with exponential decrease when between sigma 0 and 1
  uint sigma = taxRecord[_taxID].bellcurve.sigma[_node];
  ratio *= 1 − (sigma/1)^2;

  taxRecord[_taxID].ratio[_node] = ratio;
  taxRecord[_taxID].sum += ratio;
}


where distance is in number of people, along a radius from the origin point of the swarm redistribution pulse (horizontally at any given distance people get the same ratio, only decreases with distance), maximum_propagation_distance is how far the pulse travels, an example being maximum_propagation_distance = 10.

The tax is then claimed using claimTax(),

function claimTax(address _node, bytes32 _taxID) {
    require(taxRecord[_taxID].timestamp + 12 days < now);
    require(taxRecord[_taxID].ratio[_node] != 0);
    require(taxRecord[_taxID].claimed[_node] == false);
    uint amount = taxRecord[_taxID].amount * taxRecord[_taxID].ratio / taxRecord[_taxID].sum;
    rewardTax(msg.sender, amount);
    taxRecord[_taxID].claimed[_node] = true;

    // Decay the pathway with ratio minus exponential adjustment, so exponential decay

    uint sigma = taxRecord[_taxID].bellcurve.sigma[_node];
    uint ratio = taxRecord[_taxID].ratio[_node];
    uint decayRatio = ratio / (1 − (sigma/1)^2);
    uint decayAmount = taxRecord[_taxID].amount * decayRatio / taxRecord[_taxID].sum;
}
Sort:  

wow! what good analysis sir johan, quite deep

I don´t understand a shit of this Johan, but I have the intuition that you have a moral intel, so I upvote you bro;)

It's a "bell curve" that, in every single swarm redistribution pulse (millions of those, happen every transaction), sets a cap to the reward from the pulse (basic income) based on how much a person has received so far (monthly, probably), anyone above average will get exponentially less, up to "some people" who get nothing. It's a dynamic cap, that adapts and adjusts itself based on trends like tax-rates, how densely connected the transaction-web is in different clusters.

Highly rEsteemed!

interesting curve pattern you explained great details

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 61651.16
ETH 2369.36
USDT 1.00
SBD 2.50