Correlation
Computes an estimate of the correlation or weighted correlation between two quantities.
Simple Usage
When X and Y are both uncertain quantities, the correlation is computed by
Correlation(X,Y)
Correlation of Data
If you have a data set containing two variables, A and B, where data points are indexed by J, the correlation of A and B is computed using
Correlation(A,B,J)
Here J is referred to as the running index.
If you have an array in which you want to find the correlation of two columns, then you will apply the subscript operator to extract each column. For example, the following computes the correlation between historical revenue in 2002 and 2003 (where data points are indexed by J).
Correlation( HistoricalRevenue[Year=2002], HistoricalRevenue[Year=2003], J )
Weighted Correlation
Unweighted correlation treats all data or sample points as equally weighted. Weighted correlation computes the correlation when each data point may have a different weight. The optional w parameter may be used to specify a weight, which should be indexed by the running index (or by Run if no running index is specified). For example, the following specifies an importance weight:
Correlation( X,Y, w:sampleImportance )
The global sample weighting, specified by the system variable SampleWeighting, is used by default.
Full Declaration
Correlation(X,Y : Numeric ContextSamp[I] ; I : IndexType=Run ; w : NonNegative ContextSamp[I] = SampleWeighting )
Mathematical Details
Weighted correlation is given by [math]\displaystyle{ {\sum_i { w_i \hat{x}_i \hat{y}_i } \over {\sqrt( \sum_i w_i \hat{x}_i^2 \sum_i w_i \hat{y}_i^2} ) } }[/math]
Enable comment auto-refresher
Pdavis2