> Still, with a little invention I think this could be easily worked 
> around. Especially with the functor model. Either with separate 
> extensions of the increment method that could accept precalculated 
> moments to use in the calculation, or constructors that wire in the 
> moment being used by the UnivaraiateStatistic, thus reducing the 
> replication.
> 
> *Constructor approach to reusing moments.*
> Mean mean = new Mean();
> SecondMoment m2 = new SecondMoment(mean);
> ThirdMoment m3 = new ThirdMoment(mean, m2);
> FourthMoment m4 = new FourthMoment(mean, m2, m3);
> Variance var = new Variance(m2);
> Skew skew = new Skew(variance, m3);
> Kurt kurt = new Kurt(variance, m4);

> 
> *Incremental approach to reusing moments.*
> Mean mean = new Mean();
> SecondMoment m2 = new SecondMoment();
> ThirdMoment m3 = new ThirdMoment();
> FourthMoment m4 = new FourthMoment();
> Variance var = new Variance();
> Skew skew = new Skew();
> Kurt kurt = new Kurt();
> 
> mean.increment(d);
> m2.increment(d, m1);
> m3.increment(d, m1, m2);
> m4.increment(d, m1, m2, m3);
> 
> var.increment(d, m1);
> skew.increment(d, m2);
> kurt.increment(d, m4);
> 

One problem with this approach, is now order of computation for each
statistic object is a big concern.  The responsibility of correct
ordering would have to be placed in univariate with Mark's statistics
objects.  It would be better to place that responsibility in the
statistic objects themselves

Maybe we could make composite statistic objects that can compute more
than one metric.  The composite would conform to the same statistic
interface and would be adaptable into individual metrics.  Also, the
responsibility of computation ordering would be hidden in the
composite, removed from univariate.

Brent Worden
http://www.brent.worden.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to