You are here: Symbol Reference > Dew.Stats Namespace > Statistics Class > Statistics Methods > CorrCoef Method > CorrCoef Method (TDenseMtxVec, TDenseMtxVec, TMtx)
Dew Stats for .NET
Contents
C# Example

Calculate correlation coefficients from Data1 and Data2 representing two variables.

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 (c) 1999-2010 by Dew Research. All rights reserved.