Array truncation for simple linear regression


Recommended Posts

I want to find the best-fit slope from an array depicting S-curve.

I want to truncate away my array that is 60%max and min at both ends.

Filter(Array, Criteria Array) seems to address this solution.

How would Criteria Array be setup?

Link to comment
Share on other sites

There is no built in function for curve fit, so you are going to have to figure that one out on your own. There are plenty of algorithms to do it which should be easy to script.

As for filter, you're going to need to create a separate array with the y values of the fit line for each of the x values of your main array, so basically both array and fitarray will have the same x coordinates for a particular array index. Then the filter is simple:

resultArray = filter(array, (array < fitArray * 1.6) && (array > fitArray * 0.4))

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.