Re: How to use DhbLeastSquareFit?
Posted by
Uko on
Feb 21, 2016; 9:23pm
URL: https://forum.world.st/How-to-use-DhbLeastSquareFit-tp4878166p4879424.html
Hi,
this was super useful.
One thing that I’ve noticed, is that if all the values are the same, a zero divide exception happens when correlationCoefficient is calculated. Does if have to be like that, or there is a way to treat this case?
Cheers.
Uko
Hi Yuriy,
do you mean something like this:
x:=#(1 2 4 8 9).
y:=#(3 4 5 6 7).
lr:=DhbLinearRegression new.
points:=(1 to:x size) collect:[:i|( (x at:i)@(y at:i))].
points do:[:i|lr add:i].
p:=lr asEstimatedPolynomial . "-->(371/127) + (55/127) X"
b := RTGrapher new.
ds := RTDataSet new.
ds noDot.
ds points: (0 to: 10 by:2).
ds x: #yourself.
ds y: [:i|p value:i].
ds connectColor: (Color red).
b add: ds.
ds := RTDataSet new.
ds points: points.
ds x: #x.
ds y: #y.
b add: ds.
b build.
b view openWithMenu .
??
werner
On Wednesday, February 17, 2016 at 4:21:38 PM UTC+1, Yuriy Tymchuk wrote:
Hi,
I have an array of Xs and corresponding one of Ys. How can I get the least square fit? Because when I look at the class it uses histograms and distributions, etc…
Cheers :)
Uko
--
You received this message because you are subscribed to the Google Groups "SciSmalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
For more options, visit
https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "SciSmalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
For more options, visit
https://groups.google.com/d/optout.