Linear Regression

Has anyone ever done any linear regression for a series of points in a dataset that are being trended? Would like to create an overlay for a series of points being displayed.

It’s been a while since I’ve done any real math, but the most difficult part of linear regression should be setting up the equations. To take a dataset, do some calculations and then put the results back, you need something like the followig on a nearby button (or propertyChange script):[code]oldData = system.dataset.toPyDataSet(event.source.parent.getComponent(‘Table’).data)
newData = []
header = [“raw1”, “calc”]
for row in oldData:
#do your calculations
calc = (row[0]+row[1])/2
#append the data
newData.append([row[0], calc])

#store the new data
event.source.parent.getComponent(‘Table’).data = system.dataset.toDataSet(header, newData)[/code]

Thanks, I’ve got an equation for it, was hoping someone might have done this already and had a ‘canned ap’. Also just realized I posted this in the wrong place! Sorry 'bout that.