math - How to : Generate bimodal distribuctions -


im working on problem need work bimodal histograms.like on example below.

example of bimodal histogram

but im getting hard times looking them. im working histograms vector, in exemplo below. there way generate random bimodal histograms programming language? (since can save histograms txt file)

histogram 1 

8029, 41, 82, 177, 135, 255, 315, 591, 949, 456, 499, 688, 446, 733, 712, 1595, 2633, 3945, 6134, 9755, 9236, 11911, 11888, 9450, 13119, 8819, 5991, 4399, 6745, 2017, 3747, 1777, 2946, 1623, 2151, 454, 3015, 3176, 2211, 1080, 391, 580, 750,

histogram 2

8082, 4857, 1494, 2530, 1604, 1636, 1651, 1681, 1630, 1667, 1636, 1649, 1934, 1775, 1701, 1691, 1478, 1649, 1449, 1449, 1503, 1475, 1497, 1398, 1509, 1747

histogram 3

50, 226, 857, 2018, 1810, 1795, 1840, 1929, 1942, 1693, 1699, 1547, 1564, 1556, 1451, 1439, 1448, 1357, 1428, 1419, 1383, 1705, 1670, 1777, 1826, 1865, 1897 .

you parameterize unimodal distributions peaks want them, , choose among them desired relative proportions.

for instance, 100k observations following generating formula:

if( :selectprobability <= 0.4, random exp() * 3, if( :selectprobability <= 0.6, random normal() * 0.5 + 3, random normal() + 7 )

produced histogram:

histogram 3 modes

where 40% of time generate exponential mean of 3, 20% of time n(3, 0.5), , remainder of time n(7,1).

adjust distributions, means, standard deviations, , proportions suit.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -