commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brent Worden" <brent.wor...@gmail.com>
Subject RE: [math] ChiSquaredDistributionImpl
Date Wed, 05 Mar 2008 16:55:19 GMT
Al,

You can do this one of two ways using the distribution.

One way is to compute the cumulative probability based on the observed
value:

ChiSquaredDistributionImpl dist = new ChiSquaredDistributionImpl(df);
double p = dist.cumulativeProbability(observed);

then compare p to some confidence level or alpha value.  Note,
cumulativeProbablity returns the probability of observing a value less
than or equal to the given value (i.e. the lower tail probability).
More than likely, you'll want the upper tail probability for comparison
purposes, which is simply 1.0 - p.

The other was is to compute the critical value for a given confidence
level or alpha value:

ChiSquaredDistributionImpl dist = new ChiSquaredDistributionImpl(df);
double value = dist.inverseCumulativeProbability(level);

then compare value to the observed value.  Again, take into account
inverseCumulativeProbability uses the lower tail for computing critical
values.

HTH,

Brent Worden

-----Original Message-----
From: Al Lelopath [mailto:jdaues@gmail.com] 
Sent: Wednesday, March 05, 2008 9:32 AM
To: Jakarta Commons Users List
Subject: [math] ChiSquaredDistributionImpl

I am using ChiSquaredDistributionImpl, but I am not confident I am
doing it correctly.

I've calculated the "observed" value (to compare to the critical
value) and the degrees of freedom.
I create the impl like so:
ChiSquaredDistributionImpl chiSquaredDistributionImpl = new
ChiSquaredDistributionImpl(degreesOfFreedom);
double chiSquareCriticalValue =
chiSquaredDistributionImpl.cumulativeProbability(degreesOfFreedom);

but something does seem quite right.
For one thing, I haven't specified a confidence interval for the
critical value, i.e. 95%? 98%?

Is there an example of how to do this?

---------------------------------------------------------------------
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


Mime
View raw message