Example #1
0
        public string ToReport(string dv, string filter)
        {
            Console.WriteLine($"Filter by: {filter}");
            var regex = new Regex(filter, RegexOptions.IgnoreCase);

            var result = new StringBuilder($"Name:{dv}Independent(X){dv}vs Dependent(Y){dv}Correlation{dv}MeanX{dv}Slope\n");

            if (dv.Equals("|"))
            {
                result.Append(IntelCore.WriteDivider(Regex.Matches(result.ToString(), @"\|").Count) + "\n");
            }

            foreach (var item in Stats.OrderByDescending(r => r.Value.Correlation()))
            {
                var xyNames = IntelCore.GetNames(item.Key.Split('_'));
                var stat    = item.Value;

                if (regex.IsMatch(item.Key))
                {
                    result.Append(
                        $"{item.Key}:{dv}{xyNames[0]}{dv}vs {xyNames[1]}{dv}{stat.Correlation():F3}{dv}{stat.MeanX():F1}{dv}{stat.Slope():F5} {IntelCore.GetXyUnits(item.Key)}\n");
                }
            }

            return(result.ToString());
        }
Example #2
0
        /// <summary>
        /// </summary>
        /// <param name="dv"></param>
        /// <param name="gdpAbove"></param>
        /// <param name="gdpBelow"></param>
        /// <returns></returns>
        public string ToReport(string dv, double gdpAbove, double gdpBelow)
        {
            var result = new StringBuilder($"Name:{dv}Independent(X){dv}vs Dependent(Y){dv}Correlation{dv}MeanX{dv}Slope\n");

            if (dv.Equals("|"))
            {
                result.Append(IntelCore.WriteDivider(Regex.Matches(result.ToString(), @"\|").Count) + "\n");
            }

            foreach (var item in Stats.OrderByDescending(r => r.Value.Correlation()))
            {
                var xyNames = IntelCore.GetNames(item.Key.Split('_'));

                var stat = item.Value;
                if (item.Value.Correlation() > gdpAbove || item.Value.Correlation() < gdpBelow)
                {
                    result.Append(
                        $"{item.Key}:{dv}{xyNames[0]}{dv}vs {xyNames[1]}{dv}{stat.Correlation():F3}{dv}{stat.MeanX():F1}{dv}{stat.Slope():F3} {IntelCore.GetXyUnits(item.Key)}\n");
                }
            }

            return(result.ToString());
        }