Question
Pareto distribution Create the Pareto distribution and graph it using asterisks just like specified above. Note: unlike the uniform and triangular distributions above, the Pareto
Pareto distribution
Create the Pareto distribution and graph it using asterisks just like specified above. Note: unlike the uniform and triangular distributions above, the Pareto distribution will not always give you values between 0 to 1! So the binning (of the value into 10 slots between 0 and 1) will not be accurate (a lot of values will get missed because they are >1, for example).
In 'ProbabilityDistributions.pdf' [whose link in the above paragraph above], look at the end of the 'Summary' section, for the entry on Pareto - that gives you what you need to generate the distribution [hint: use 'inverse transformation', with a suitable positive decimal value, found via trial and error, for 'a'; good values lie between 0.0 and 1.5; your distribution curve needs to have a steep/sharp 'falloff'].
Here's what you do (if you get values between 0 and >1 from your distribution) - loop TWICE - the first time, don't bin the values; instead, find the largest value (ie. max) that gets output; the second time, divide each value by the max you just found, to get a 0 to 1.0 result which you can now bin as usual. Pseudocode:
seed the rand function with a known seed double largestVal = -10000000; // a SMALL value for each of N times generate a Pareto value if value>largestVal, largestVal=value // we have a new largestVal next iteration // now we know the largest value, it's stored in largestVal RE-seed the rand function with the same seed used earlier (to restart the sequence) for each of N times generate a Pareto value divide by largestVal // this will now be 0..1 'bin' the result
But what if the min is not 0 (eg. the distribution gives you values between 1 and 3, instead of 0 to 3)? Solution: track the 'min' too in addition to tracking 'max', and normalize. Pseudocode again:
seed the rand function with a known seed double largestVal = -10000000, smallestVal = 10000000; for each of N times generate a Pareto value if value > largestVal, largestVal=value // we have a new largestVal if value < smallestVal, smallestVal=value next iteration // now we know the largest AND smallest values, use them to normalize RE-seed the rand function with the same seed used earlier (to restart the sequence) for each of N times generate a Pareto value 'p' pNorm = (p - smallestVal)/(largestVal - smallestVal) // 0..1 do binning on pNorm
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started