Calculations of moments of a statistical distribution
Source code name: "stat_moments.py"
Programming language: Python
Topic: Statistics/Descriptive
DMelt Version 1. Last modified: 12/11/2015. License: Pro
https://datamelt.org/code/cache/stat_moments_3699.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.



from jhplot  import *
from java.util import Random
from jhpro.stat  import Moments

c1 = HPlot("Canvas",600,400)
c1.visible(1)
c1.setNameX("Moment order")
c1.setNameY("Values")
c1.setAutoRange() 

m=Moments(4) # calculates moments up to 4th order

# use a Gaussian random numbers
r=Random();
for i in range(100):
            m.process(r.nextGaussian()+0.5)

c1.draw(m.getResults())


You see the box below because you did not login.