Click or drag to resize
sqx

ROBCOR Structure

Aggregate [float] ROBCOR([float] X, [float] Y, [float] MeanX, [float] MeanY, [bit] Population)

Namespace:  sqx
Assembly:  SQX (in SQX.dll) Version: 1.0.2.6 (1.0.2.6)
Syntax
C#
[SerializableAttribute]
public struct ROBCOR
Remarks
Robuste Pearson's correlation coefficient aggregate function.

NOTE: All parameters except X, Y must remain constant within the GROUP BY.

Attributes

Format.Native, IsInvariantToDuplicates = false, IsInvariantToNulls = true, IsInvariantToOrder = true, IsNullIfEmpty = true
Examples
SQL
declare @Va sqx.Vector = sqx.RandomVector(10,1)
declare @Vb sqx.Vector = sqx.RandomVector(10,2)
;with sample_data as (
select a.ID, a.Value X, b.Value Y
from sqx.VectorTable(@Va) a
inner join sqx.VectorTable(@Vb) b
on a.ID = b.ID
)
select sqx.ROBCOR(X,Y,MX,MY,1) Correlation
from (select sqx.MEAN(X) MX, sqx.MEAN(Y) MY from sample_data) m
cross apply sample_data
/*
Correlation
----------------------
0.0171373794175596*/
See Also