Click or drag to resize
Covariances Class
Computes the sample variance-covariance or correlation matrix.
Inheritance Hierarchy
SystemObject
  Imsl.StatCovariances

Namespace: Imsl.Stat
Assembly: ImslCS (in ImslCS.dll) Version: 6.5.2.0
Syntax
[SerializableAttribute]
public class Covariances

The Covariances type exposes the following members.

Constructors
  NameDescription
Public methodCovariances
Constructor for Covariances.
Top
Methods
  NameDescription
Public methodCompute
Computes the matrix.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetIncidenceMatrix
Returns the incidence matrix. Note that the Compute method must be invoked first before invoking this method. Otherwise, the method throws a NullReferenceException exception.
Public methodGetMeans
Returns the means of the variables in x.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSetFrequencies
The frequency for each observation.
Public methodSetWeights
Sets the weight for each observation.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyMissingValueMethod
Sets the method used to exclude missing values in x from the computations.
Public propertyNumberOfProcessors
Perform the parallel calculations with the maximum possible number of processors set to NumberOfProcessors.
Public propertyNumRowMissing
Returns the total number of observations that contain any missing values (Double.NaN). Note that the Compute method must be invoked first before invoking this method. Otherwise, the return value is 0.
Public propertyObservations
Returns the sum of the frequencies. Note that the Compute method must be invoked first before invoking this method. Otherwise, the return value is 0.
Public propertySumOfWeights
Returns the sum of the weights of all observations. Note that the Compute method must be invoked first before invoking this method. Otherwise, the return value is 0.
Top
Remarks

Class Covariances computes estimates of correlations, covariances, or sums of squares and crossproducts for a data matrix x. Weights and frequencies are allowed but not required.

The means, (corrected) sums of squares, and (corrected) sums of crossproducts are computed using the method of provisional means. Let x_{ki} denote the mean based on i observations for the k-th variable, f_i denote the frequency of the i-th observation, w_i denote the weight of the i-th observations, and c_{jki} denote the sum of crossproducts (or sum of squares if j = k) based on i observations. Then the method of provisional means finds new means and sums of crossproducts as shown in the example below.

The means and crossproducts are initialized as follows:

x_{k0}  = 0.0\,\,\,\,\,for\,\,k = 1,\, 
            \ldots ,\,p

 c_{jk0}  = 0.0\,\,\,for\,\,j,\,k = 1,\, 
            \ldots ,\,p

where p denotes the number of variables. Letting x_{k,i+1} denote the k-th variable of observation i + 1, each new observation leads to the following updates for x_{ki} and c_{jki} using the update constant r_{i+1}:

r_{i + 1}  = \frac{{f_{i + 1} w_{i + 1} 
            }}{{\sum\limits_{l = 1}^{i + 1} {f_l w_l } }}

\bar x_{k,\;i + 1}  = \bar x_{ki}  + \left( 
            {x_{k,\;i + 1}  - \bar x_{ki} } \right)r_{i + 1}

c_{jk,\;i + 1}  = c_{jki}  + f_{i + 1} 
            w_{i + 1} \left( {x_{j,\;i + 1}  - \bar x_{ji} } \right)\left( 
            {x_{k,\;i + 1}  - \bar x_{ki} } \right)\left( {1 - r_{i + 1} } 
            \right)

The default value for weights and frequencies is 1. Means and variances are computed based on the valid data for each variable or, if required, based on all the valid data for each pair of variables.

See Also

Reference

Other Resources