protected override double[,] ComputeCorrelation(int window, int startingPoint) { double[,] data = new double[window, Option.UnderlyingShareIds.Length]; for (int i = 0; i < window; i++) { for (int j = 0; j < Option.UnderlyingShareIds.Length; j++) { data[i, j] = Spots[startingPoint - window + i][j]; } } double[,] correlation = WRE.computeCorrelationMatrix(data); return(correlation); }
public void computeCorrelationMatrixTest() { // header Debug.WriteLine("******************************"); Debug.WriteLine("* WREmodelingCorr in C# *"); Debug.WriteLine("******************************"); // sample data double[,] returns = { { 0.05, 0.05, 0.6 }, { -0.001, -0.001, 0.56 }, { 0.7, 0.7, 0.12 }, { -0.3, -0.3, -0.1 }, { 0.1, 0.1, 0.3 } }; // call WRE via computeCovarianceMatrix encapsulation WRE classWRE = new WRE(); double[,] myCorrMatrix = WRE.computeCorrelationMatrix(returns); // display result WRE.dispMatrix(myCorrMatrix); // ending the program Console.WriteLine("\nType enter to exit"); }