URI: http://www.qualityml.org/1.0/metrics/CovarianceMatrix
Name: CovarianceMatrix
Alternative names: Variance-covariance matrix, Variance matrix
Definition:

Given d univariate random variables (x1,...,xd), the covariance matrix of (x1,...,xd) is the d X d matrix C whose elements Cij are the covariance between xi and xj. That is, Cij=E[(xi-E[xi])(xj-E[xj])]. In particular, the diagonal elements Cii are the variances of the xi. The matrix is stored in row major format in QualityML/UncertML. It is possible that future versions of them will have specialised types for simpler covariance matrices, such as sparse, outer product, block and n-diagonal matrix types.

Parameters: d (dimension) the number of random variables
Source: UncertML
Categories: Thematic accuracy
Further information: Extracted from UncertML http://www.uncertml.org/statistics/covariance-matrix. See also http://mathworld.wolfram.com/CovarianceMatrix.html,
XML schema:
 
<!-- Element -->
<xs:element name="CovarianceMatrix" substitutionGroup="un:AbstractSummaryStatistic">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="un:CovarianceMatrixType"/>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<!-- Complex type -->
<xs:complexType name="CovarianceMatrixType">
  <xs:complexContent>
    <xs:extension base="un:AbstractSummaryStatisticType">
      <xs:sequence>
        <xs:element name="values" type="un:ContinuousValuesType"/>
      </xs:sequence>
      <xs:attribute name="dimension" type="un:naturalNumber" use="required"/>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>
                
XML example:
<!-- Multiple values -->
<un:CovarianceMatrix dimension="2" xmlns:un="http://www.uncertml.org/2.0">
  <un:values>3.14 0.0 0.0 3.14</un:values>
</un:CovarianceMatrix>
                
JSON example:
// Multiple values
{"CovarianceMatrix":{"dimension":2,"values":[3.14,0.0,0.0,3.14]}}
                
API example:
// Multiple value declaration
CovarianceMatrix cm = new CovarianceMatrix(2, new double[] {3.14, 0.0, 0.0, 3.14});

// Parsing from an XML file
XMLParser xml = new XMLParser();
CovarianceMatrix cm = (CovarianceMatrix)xml.parse(new File("covariance-matrix.xml"));

// Parsing from a JSON file
JSONParser json = new JSONParser();
CovarianceMatrix cm = (CovarianceMatrix)json.parse(new File("covariance-matrix.json"));

// Encoding to an XML file
XMLEncoder xEncoder = new XMLEncoder();
xEncoder.encode(cm, new File("covariance-matrix.xml"));

// Encoding to a JSON file
JSONEncoder jEncoder = new JSONEncoder();
jEncoder.encode(cm, new File("covariance-matrix.json"));
                
Value constraints: dimension: any natural number
values: any real number