views:

172

answers:

1

Hello! I am currently working on a project where I need to generate multiple values (floats or doubles preferably) that follow a power law distribution with a given exponent!

I was advised to use the MathNet.Iridium library to help me. The problem I have is that the documentation is not as explicit as it should be if there is any!

I see multiple distributions that fit the general idea of the power law distribution but I cannot pinpoint a good distribution to use with a certain exponent as a parameter.

Does anybody have more experience in that matter and could give me some hints or advice?

A: 

To generate values of a distribution of your choice, you could use the inverse cumulative distribution function, as mentioned in the wikipedia.

Step by step, this would look like:

  1. Choose a distribution function that you like.
  2. Calculate the inverse cumulative distribution function using pen and paper.
  3. Generate a value based on a uniform distribution on the unit interval. Random will do nicely here.
  4. Input the value into your ICDF.

The result is a value chosen at random using your chosen distribution function.

If you run into problems with step 2, maybe the folks at http://mathoverflow.net/ can help you.

Edit: If you just need any power law distribution with exponent gamma, this will generate one value:

double r = 1.0 / Math.Pow(1-new Random().NextDouble(), 1.0/(gamma+1));
Jens
My problem is in choosing the distribution function because of the lack of documentation. I have a base X that I know and a power law exponent gamma that I know. I could use a random number to generate some jitter and together with the exponent than modify my base. But the problem is that I want my result set to follow a power law distribution. I was told that this would be possible using one of the distributions from MathNet.Iridium where it would make sure that the values you get would in the end follow a power law distribution.I do not really see why I would need the ICDF.
Eric Tobias
@Eric: I looked at the probability distributions listed in Math.Iridium's complete feature list, and none of these seemed to be power law with an arbitrary exponent, so I figured you need to build your own.
Jens
Thank you for your help! I will see what I can do!
Eric Tobias