Exemple #1
0
        /// <summary>
        /// Develops the model's cumulative triangle into a run-off square with the calculated factors of the additive method.
        /// </summary>
        /// <returns>The projected run-off square according to the additive method.</returns>
        protected override IReadOnlySquare CalculateProjection()
        {
            ISquare calc = new Square(Triangle.Periods);

            calc.SetColumn(Triangle.GetColumn(0), 0);

            for (int i = 0; i < calc.Periods - 1; i++)
            {
                IEnumerable <decimal> calculatedValues = _premiums
                                                         .Skip(calc.Periods - i - 1)
                                                         .Select(x => Factors[i + 1] * x)
                                                         .Zip(calc.GetColumn(i).Skip(calc.Periods - i - 1), (x, y) => x + y);

                calc.SetColumn(_cumulativeTriangle.GetColumn(i + 1).Concat(calculatedValues), i + 1);
            }

            return(calc.AsReadOnly());
        }