public static void Sample1() { InitializeSecurityReturns(); List <SecurityReturns> srList = new List <SecurityReturns> { goog, gs, msft, spy }; foreach (SecurityReturns sr in srList) { //Statistics are annualized using 256 days per year double mean = 256 * Moments.Mean(sr.returns); double vol = 16 * Moments.StandardDeviation(sr.returns); double skew = Moments.Skewness(sr.returns) / 16; double exKurt = Moments.ExcessKurtosis(sr.returns) / 256; Regression regression = new Regression(sr.returns, spy.returns, true, true); Console.WriteLine("Summary stats for: {0}", sr.tkr); Console.WriteLine(" mean = {0}", mean.ToString("0.00%")); Console.WriteLine(" vol = {0}", vol.ToString("0.00%")); Console.WriteLine(" skew = {0}", skew.ToString("0.00%")); Console.WriteLine(" exKurt = {0}", exKurt.ToString("0.00%")); Console.WriteLine(" beta = {0} ({1})", regression.Betas[1].Value.ToString("0.00"), regression.Betas[1].pValue.ToString("0.00%")); Console.WriteLine(" R^2 = {0}", regression.rSquared.ToString("0.00%")); Console.WriteLine(); } Console.ReadLine(); }