<p dir="auto">Today I add the chi-square distribution to my collection.
<p dir="auto">Since the same parameters are used here as for the student's t-distribution, the GUI does not need to be extended.
<h2>Calculation of the distribution
<pre><code> double dchisq(double x, int df) {
if (x<=0) {
return 0.0;
}
return
(Math.pow(x, df/2.0 - 1.0) * Math.exp(-(x/2.0))) /
(Math.pow(2, df/2.0) * XMath.gamma(df/2.0));
}
public double qchisq(double alpha, int df) {
double sum = 0;
double pos = 0;
double stepSize = 0.01;
while (sum<alpha) {
sum += dchisq(pos, df)*stepSize;
pos += stepSize;
}
return pos;
}
<p dir="auto">Other distributions:
<ul>
<li><a href="https://steemit.com/programming/@darkstar-42/the-normal-distribution-compute-and-visualize-in-java" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Normal Distribution
<li><a href="https://steemit.com/programming/@darkstar-42/java-student-t-distribution-java-student-t-verteilung" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Student t-Distribution
<li><a href="https://steemit.com/java/@darkstar-42/the-f-distribution-compute-and-visualize-in-java" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">F-Distribution
The Chi-Squared-Distribution - Compute and visualize in Java
7 years ago in #programming by darkstar-42 (45)
$0.22
- Past Payouts $0.22
- - Author $0.17
- - Curators $0.04
Cool demonstration 👍