コード例 #1
0
        public static double GetCorrelationBetween(TimeSeries ts1, TimeSeries ts2)
        {
            DateTime[] commonDomain = ts1.GetCommonDates(ts2)
                                      .OrderBy(date => date)
                                      .ToArray();
            IEnumerable <double> x = commonDomain.Select(date => ts1[date]);
            IEnumerable <double> y = commonDomain.Select(date => ts2[date]);

            return(Correlation.Pearson(x, y));
        }