Convolution of 2 random distributionis (Gamma with Poisson)
Source code name: "stat_random_convolute.py"
Programming language: Python
Topic: Statistics/Random
DMelt Version 1. Last modified: 10/19/2015. License: Pro
https://datamelt.org/code/cache/stat_random_convolute_7818.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


# S.Chekanov


from org.apache.commons.math3.random import *
from jhplot import *

r=RandomDataGenerator()

c1=HPlot()
c1.visible()
c1.setRangeX(0,100)

h1=H1D("Gamma x Poisson",100,0,100)
tot=100000
shape=10
scale=3.0
r=RandomDataGenerator()
for i in range(tot):
   mean=r.nextGamma(shape,scale)
   value=r.nextPoisson(mean)
   # print value
   h1.fill(value)

c1.draw(h1)


You see the box below because you did not login.