Dew Stats Master .NET
CorrCoef Routines
Summary
Correlation coefficients.

Unit
Statistics

Declaration
Procedure CorrCoef(X, Y: TMtx; Result: TMtx);

Description
Calculate the correlation coefficients and write them in the Result matrix, assuming matrices X and Y are two variables and all X and Y matrix elements are the observables.
Categories
Descriptive statistics routines
 See Also 
Covariance 

Declaration
Procedure CorrCoef(X: TMtx; Result: TMtx);

Description
Calculate the correlation coefficients and write them in the Result matrix, assuming the X matrix columns are the variables and rows are the observables.
Declaration
Procedure CorrCoef(X, Y: TVec; Result: TMtx);

Description
Calculate the correlation coefficients and write them in the Result matrix, assuming vectors X and Y are two variables and their elements are the observables.

Example 1

Calculate correlation coefficients from Data1 and Data2 representing two variables.

Uses MtxExpr, Statistics; procedure Example; var Data1, Data2: Vector; CorrMtx : Matrix; begin Data1.SetIt(False,[1,2,3]); Data2.SetIt(False,[5,5.5,1]); CorrCoef(Data1,Data2,CorrMtx); // CorrMtx = [1.00000000, -0.81088485, // -0.81088485, 1.00000000] end;
#include "MtxVecCpp.h" #include "Statistics.hpp" void __fastcall Example() { Vector data1,data2; Matrix corr; data1->SetIt(false,OPENARRAY(double,(1,2,3))); data2->SetIt(false,OPENARRAY(double,(5,5.5,1.0))); CorrCoeff(data1,data2,corr); // corr = [1.00000000, -0.81088485, // -0.81088485, 1.00000000] }
using Dew.Math; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { Vector data1 = new Vector(0); Vector data2 = new Vector(0); Matrix corr = new Matrix(0,0); data1.SetIt(false, new double[] {1,2,3}); data2.SetIt(false, new double[] {5, 5.5, 1.0} ); Statistics.CorrCoeff(data1,data2,corr); // corr = [1.00000000, -0.81088485, // -0.81088485, 1.00000000] } }


Copyright 2008 Dew Research
http://www.dewresearch.com