 |
Loess (Lowess) smoothing of data
Source code name: "stat_smoothing_data.py"
Programming language: Python
Topic: Statistics/Smoothing
DMelt Version 1. Last modified: 05/26/2016. License: Pro
https://datamelt.org/code/cache/stat_smoothing_data_2618.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 java.awt import Color,Font
from java.util import Random
from jhplot import HPlot,P1D
from jhplot.stat import Interpolator
c1 = HPlot("Canvas")
c1.visible()
c1.setRange(0,100,0,100)
h = P1D("Data")
r=Random()
for i in range(100):
h.add(i,i+r.nextGaussian()*0.2*i,0.1,0.1,0.2,0.2)
c1.draw(h)
k=Interpolator(h)
p1=k.smoothLoess(0.3,0,0.4)
p1.setStyle("l")
p1.setColor(Color.red)
c1.draw(p1)
You see the box below because you did not login.