# commons-user mailing list archives

##### Site index · List index
Message view
Top
From Luc Maisonobe <Luc.Maison...@free.fr>
Subject Re: [math] Example using EstimationProblem, WeightedMeasurement from apache.commons.math?
Date Tue, 20 Nov 2007 22:45:03 GMT
```mickeydog@TaosNet.com a écrit :
> Wow, thanks Luc.
>
> One correction, I think. In the theoreticalValue() method, this:
> return ((a.getEstimate() * x + b.getEstimate()) * x  + c.getEstimate());
> should be:
> return ((a.getEstimate() * x * x + b.getEstimate()) * x  +
> c.getEstimate());
No. This is Hörner's way to evaluate polynomials, an efficient way. The
second x in my statement is applied to the sum a.getEstimate() * x +
b.getEstimate(), so at the end we really have a * x² + b * x + c as
required for a quadratic polynomial. The trick is in the parentheses.

Luc
>
> > mickeydog@TaosNet.com a écrit :
> >> Thanks for the reply and my apologies for omitting the [math] marker.
> >>
> >> Afa the model goes, I'm not sure how to answer.  What I am doing is
> >> smoothing a curve using the loess function, and the last step is to use
> >> a
> >> weighted least square regression on each point and its neighborhood.
> > In addition to my previous message where I gave an implementation based
> > on EstimationProblem and WeightedMeasurement as specified, I would like
> > to say that in this very simple case, using these classes is probably
> > overkill. Low degree polynomials fitting in one dimension only can be
> > done very simply with a single loop updating some sums as each sample
> > point is added and performing a simple direct computation to retrieve
> > the polynomials coefficients at the end of the loop.
> >
> > EstimationProblem, EstimatedParameters and WeightedParameters are more
> > suited for non-linear problems with several different measurements types
> > and parameters and complex models. The reference use case for which this
> > class was created was to perform spacecraft orbit determination from
> > range, range-rate, angular and more exotic measurements with a numerical
> > model taking into account several perturbing forces. This requires some
> > features that add to the complexity of the classes. I'm not sure using
> > such heavyweight component is wise for your case. You may have
> > performance issues with them.
> >
> > Luc
> >
> >>
> >>> Hi,
> >>>
> >>> First of all, I have added a [math] marker on the subject line. This
> >>> list
> >>> is shared among all commons projects and this type of markers help
> >>> people
> >>> filter the messages.
> >>>
> >>> I will send a usage example on the list in a few hours (late evening,
> >>> european time), when I'm back home. Would you like to have anything
> >> special in this example ? For example what kind of model do you want to
> >> be fitted to the x,ydata ?
> >>> Luc
> >>>
> >>> Selon mickeydog@TaosNet.com:
> >>>
> >>>> Can anybody show me an example of a weighted least squares regression
> >>>> using classes like EstimationProblem, WeightedMeasurement from
> >>>> apache.commons.math?
> >>>>
> >>>> I have data that looks like this: (x,y,weight), e.g.
> >>>> 1,1,0.2
> >>>> 2,3, 0.4
> >>>> 3,2, 1.0
> >>>> 4,6, 0.8
> >>>> 5,4, 0.3
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: user-help@commons.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > For additional commands, e-mail: user-help@commons.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org