Hi Gilles.
I do it and Thank you for your patient guidance.
cheers
On Fri, Jun 19, 2015 at 2:51 AM, Gilles <gilles@harfang.homelinux.org>
wrote:
> Hello.
>
> On Fri, 19 Jun 2015 01:46:25 0700, narjes saraie wrote:
>
>> Hi Gilles,
>>
>>
>> I run this example in Netbeans and struct t distribution
>>
>> TDistribution t = new TDistribution(29);
>> double lowerTail = t.cumulativeProbability(2.656); // P(T(29) <=
>> 2.656)
>> double upperTail = 1.0  t.cumulativeProbability(2.75);// P(T(29) >= 2.75)
>> double m = t.density(3);
>> out.println( m );
>>
>>
>> I want to see how I can plot this distribution or
>> t.cumulativeProbability(X>x)?
>>
>
> As Phil already told you, there is no plotting utility within Commons Math.
> Commons Math is "only" a library of mathematical algorithms.
>
> In your above case, you could write the values to an ASCII file (and then
> use a plotting tool to display them).
> In java, this would be a code similar to the following ("import" and
> exception
> handling omitted):
>
> CUT
> String filename = "distribution.dat";
> BufferedOutputStream out = new BufferedOutputStream(new
> FileOutputStream(filename));
>
> TDistribution t = new TDistribution(29);
>
> final double min = 10;
> final double max = 15;
> final double delta = 0.01;
> for (double x = min; x < max; x += delta) {
> final double upperTail = 1  t.cumulativeProbability(x);
> out.println(x + " " + upperTail);
> }
>
> out.close();
> CUT
>
> One plotting tool is "gnuplot":
> http://gnuplot.sourceforge.net/demo/
>
>
> HTH,
> Gilles
>
>
>
>> thanks .
>>
>> On Thu, Jun 18, 2015 at 7:38 AM, Gilles <gilles@harfang.homelinux.org>
>> wrote:
>>
>> Hi.
>>>
>>>
>>> On Thu, 18 Jun 2015 06:31:00 0700, narjes saraie wrote:
>>>
>>> Hi All.
>>>> I am beginner in java and have some data.I want to guess a distribution
>>>> for
>>>> my data then calculate goodness of fit (gof).
>>>> I find distribution commons math and use it ,if i want plot my
>>>> distribution
>>>> or CDF or probability (X>x), how do it?
>>>> is it any example for distribution and plotting it.
>>>> thanks.
>>>>
>>>>
>>> Perhaps it would be clearer to see what you mean with a code example.
>>>
>>> If you want to plot a distribution implemented in Commons Math, you'd
>>> call one the methods defined in the "RealDistribution" interface
>>> (e.g. "density(double x)").
>>>
>>> But maybe that the functionality which you are looking for is defined
>>> in package "org.apache.commons.math3.stat.inference".
>>>
>>> If you need to fit data to a model (e.g. find the parameters of an
>>> assumed distribution), it is perhaps the leastsquares fitting which
>>> you are looking for. For a univariate function, there is a utility
>>> implemented as "org.apache.commons.math3.fitting.SimpleCurveFitter".
>>>
>>>
>>> HTH,
>>> Gilles
>>>
>>>
>
>
> 
> To unsubscribe, email: userunsubscribe@commons.apache.org
> For additional commands, email: userhelp@commons.apache.org
>
>
