Login  Register

Re: How to use DhbLeastSquareFit?

Posted by werner kassens-2 on Feb 18, 2016; 12:49pm
URL: https://forum.world.st/How-to-use-DhbLeastSquareFit-tp4878166p4878481.html

additionaly there is DhbPolynomialLeastSquareFit. or do mean a nonlinear least square fit? in this case a little example would be helpful.
werner

On Thu, Feb 18, 2016 at 1:01 AM, werner kassens <[hidden email]> wrote:
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.