UncertML is an XML langauge for describing and exchanging uncertainty UncertML has numerous mechanisms for quantifying uncertainty including statistics, samples and distributions UncertML provides a concise representation of distributions
URI: http://www.uncertml.org/distributions/chi-square
UncertML name: ChiSquareDistribution
Alternative names: N/A
Definition: A random variable $$ x $$ is Chi-square distributed if the probability density function (pdf) is of the form shown below. The distribution is usually denoted as $$ x \sim \mathcal{X}_\nu $$ where $$ \nu $$ is known as the degrees of freedom (d.f) parameter. The d.f. has to be positive and $$ x $$ has to be non-negative for the density to be defined. The Chi-square distribution is a special case of the Gamma distribution where $$ X \sim Gamma(k=\nu/2, \theta=2) $$.
Parameters: $$ \nu $$ (degreesOfFreedom) a positive integer
Support: $$ x $$ a positive real
PDF: $$ f(x; \nu) = \frac{1}{\Gamma(\nu/2) 2^{\nu/2}} x^{\nu/2-1} exp(-x/2) $$
Source: http://en.wikipedia.org/wiki/Chi-square_distribution
Categories: continuous variables, distribution
Further information: http://mathworld.wolfram.com/Chi-SquaredDistribution.html
XML schema:
<!-- Element -->
<xs:element name="ChiSquareDistribution" substitutionGroup="un:AbstractDistribution">
      <xs:extension base="un:ChiSquareDistributionType"/>

<!-- Complex type -->
<xs:complexType name="ChiSquareDistributionType">
    <xs:extension base="un:AbstractDistributionType">
        <xs:element name="degreesOfFreedom" type="un:PositiveNaturalNumbersType"/>
XML example:
<!-- Single value -->
<un:ChiSquareDistribution xmlns:un="http://www.uncertml.org/2.0">

<!-- Multiple values -->
<un:ChiSquareDistribution xmlns:un="http://www.uncertml.org/2.0">
  <un:degreesOfFreedom>1 2 3</un:degreesOfFreedom>
JSON example:
// Single value

// Multiple values
API example:
// Single value declaration
ChiSquareDistribution csd = new ChiSquareDistribution(1);

// Multiple value declaration
ChiSquareDistribution csd = new ChiSquareDistribution(new int[] {1, 2, 3});

// Parsing from an XML file
XMLParser xml = new XMLParser();
ChiSquareDistribution csd = (ChiSquareDistribution)xml.parse(new File("chi-square-distribution.xml"));

// Parsing from a JSON file
JSONParser json = new JSONParser();
ChiSquareDistribution csd = (ChiSquareDistribution)json.parse(new File("chi-square-distribution.json"));

// Encoding to an XML file
XMLEncoder xEncoder = new XMLEncoder();
xEncoder.encode(csd, new File("chi-square-distribution.xml"));

// Encoding to a JSON file
JSONEncoder jEncoder = new JSONEncoder();
jEncoder.encode(csd, new File("chi-square-distribution.json"));