public ConditionalAnalysis(SimulatedAnnualReturns simulatedAnnualReturns)
        {
            var parentIntervals = new Intervals(simulatedAnnualReturns.Parent);
            var groupedReturns  = new GroupedReturns(parentIntervals, simulatedAnnualReturns.Parent, simulatedAnnualReturns.Child);

            foreach (TailType tailType in Enum.GetValues(typeof(TailType)))
            {
                var intervalReturns       = groupedReturns.GetReturnsByTailType(tailType);
                var parentIntervalReturns = groupedReturns.GetParentReturnsByTailType(tailType);
                var unconditionalAnalysis = new UnconditionalAnalysis(intervalReturns, parentIntervalReturns);
                SetAnalysisByTailType(tailType, unconditionalAnalysis);
            }
        }
Exemple #2
0
        public GroupedReturns(
            Intervals parentIntervals,
            decimal[] parentRetts,
            decimal[] childRetts)
        {
            LeftTail = new List<decimal>();
            LeftNormal = new List<decimal>();
            RightNormal = new List<decimal>();
            RightTail = new List<decimal>();

            ParentLeftTail = new List<decimal>();
            ParentLeftNormal = new List<decimal>();
            ParentRightNormal = new List<decimal>();
            ParentRightTail = new List<decimal>();

            for (int cnt = 0; cnt < parentRetts.Length; cnt++)
            {
                var parentReturn = parentRetts[cnt];
                var childReturn = childRetts[cnt];
                if (parentReturn < parentIntervals.Worst)
                {
                    LeftTail.Add(childReturn);
                    ParentLeftTail.Add(parentReturn);
                }                    
                else if (parentReturn < parentIntervals.Likely)
                {
                    LeftNormal.Add(childReturn);
                    ParentLeftNormal.Add(parentReturn);
                }
                else if (parentReturn < parentIntervals.Best)
                {
                    RightNormal.Add(childReturn);
                    ParentRightNormal.Add(parentReturn);
                }
                else
                {
                    RightTail.Add(childReturn);
                    ParentRightTail.Add(parentReturn);
                }
            }
        }