You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Amnon Lahav <am...@gmail.com> on 2007/10/04 20:28:33 UTC

Re: Commons.Math.Distrubition

sorry for the delay i just noticed the reply , i'm more then willing to 
share the code i'd love to participate in the project .
i've tried using
for (int i=19;i<list.size();i++){

//DescriptiveStatistics commonsStat = DescriptiveStatistics.newInstance();

SummaryStatistics commonsStat = SummaryStatistics.newInstance();

for (int j=i-19;j<=i;j++){

commonsStat.addValue(list.get(j).indicatorPrice());

}

Indicator indicator = new Indicator();

indicator.setTime(list.get(i).indicatorTime());

indicator.setValue(commonsStat.getStandardDeviation());

SD.add(indicator);

}

----- Original Message ----- 
From: "Phil Steitz" <ph...@gmail.com>
To: "Jakarta Commons Users List" <us...@commons.apache.org>
Sent: Saturday, September 29, 2007 9:25 PM
Subject: Re: Commons.Math.Distrubition


> On 9/29/07, Amnon Lahav <am...@gmail.com> wrote:
>> Hi ,
>> how is the Standard deviation calculated in the commons math ? because 
>> i'm
>> getting diffrent values then my code which i used till far , iswtiched 
>> out
>> of runtime speed considerations and i know my code is OK since it mathces
>> the stock exchange's values ...
>> isn't is for 20days periods  ?
>> thanks .
>>
>
> The exact computation depends on whether you supply the whole array of
> values or feed them in one at a time; though for small arrays the
> results should not differ.  See
> http://commons.apache.org/math/api-1.1/org/apache/commons/math/stat/descriptive/moment/Variance.html
> for a description of the computational formulas used.  Math.sqrt is
> used to get the standard deviation from the variance.
>
> What class / method are you using?  Can you share the data and
> expected results?  If so and you can't explain the difference, please
> open a Jira ticket here.
>
> http://commons.apache.org/math/issue-tracking.html
>
> Phil
>
>>
>> ---------------------------------------------------------------------
>> 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


Re: Commons.Math.Distrubition

Posted by Phil Steitz <ph...@gmail.com>.
Can you share the data and expected results?

Phil

On 10/4/07, Amnon Lahav <am...@gmail.com> wrote:
> sorry for the delay i just noticed the reply , i'm more then willing to
> share the code i'd love to participate in the project .
> i've tried using
> for (int i=19;i<list.size();i++){
>
> //DescriptiveStatistics commonsStat = DescriptiveStatistics.newInstance();
>
> SummaryStatistics commonsStat = SummaryStatistics.newInstance();
>
> for (int j=i-19;j<=i;j++){
>
> commonsStat.addValue(list.get(j).indicatorPrice());
>
> }
>
> Indicator indicator = new Indicator();
>
> indicator.setTime(list.get(i).indicatorTime());
>
> indicator.setValue(commonsStat.getStandardDeviation());
>
> SD.add(indicator);
>
> }
>
> ----- Original Message -----
> From: "Phil Steitz" <ph...@gmail.com>
> To: "Jakarta Commons Users List" <us...@commons.apache.org>
> Sent: Saturday, September 29, 2007 9:25 PM
> Subject: Re: Commons.Math.Distrubition
>
>
> > On 9/29/07, Amnon Lahav <am...@gmail.com> wrote:
> >> Hi ,
> >> how is the Standard deviation calculated in the commons math ? because
> >> i'm
> >> getting diffrent values then my code which i used till far , iswtiched
> >> out
> >> of runtime speed considerations and i know my code is OK since it mathces
> >> the stock exchange's values ...
> >> isn't is for 20days periods  ?
> >> thanks .
> >>
> >
> > The exact computation depends on whether you supply the whole array of
> > values or feed them in one at a time; though for small arrays the
> > results should not differ.  See
> > http://commons.apache.org/math/api-1.1/org/apache/commons/math/stat/descriptive/moment/Variance.html
> > for a description of the computational formulas used.  Math.sqrt is
> > used to get the standard deviation from the variance.
> >
> > What class / method are you using?  Can you share the data and
> > expected results?  If so and you can't explain the difference, please
> > open a Jira ticket here.
> >
> > http://commons.apache.org/math/issue-tracking.html
> >
> > Phil
> >
> >>
> >> ---------------------------------------------------------------------
> >> 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
For additional commands, e-mail: user-help@commons.apache.org