Beispiel #1
0
 public ItIndexElement Calculate(
     INormalFactory normalFactory,
     IRNBCalculation RNBCalculation,
     IΛIndexElement ΛIndexElement,
     It t,
     IExpectedValueI expectedValueI,
     IVarianceI varianceI,
     Iυ2 υ2)
 {
     return(t.Value
            .Select(i =>
                    KeyValuePair.Create(
                        i,
                        RNBCalculation.Calculate(
                            normalFactory,
                            i,
                            ΛIndexElement,
                            expectedValueI,
                            varianceI,
                            υ2.GetElementAtAsdecimal(
                                ΛIndexElement))))
            .OrderBy(i => i.Value)
            .LastOrDefault()
            .Key);
 }
Beispiel #2
0
        public IΦHatResultElement Calculate(
            INormalFactory normalFactory,
            IΦHatResultElementFactory ΦHatResultElementFactory,
            IlIndexElement lIndexElement,
            IsIndexElement sIndexElement,
            IΛIndexElement ΛIndexElement,
            IExpectedValueΦ expectedValueΦ,
            IVarianceΦ varianceΦ,
            IVHat VHat,
            Iυ2 υ2)
        {
            // https://stackoverflow.com/questions/1662943/standard-normal-distribution-z-value-function-in-c-sharp
            MathNet.Numerics.Distributions.Normal normal = (MathNet.Numerics.Distributions.Normal)normalFactory.Create();

            return(ΦHatResultElementFactory.Create(
                       sIndexElement,
                       lIndexElement,
                       ΛIndexElement,
                       (decimal)expectedValueΦ.GetElementAtAsdecimal(
                           sIndexElement,
                           lIndexElement,
                           ΛIndexElement)
                       +
                       (decimal)normal.CumulativeDistribution(
                           (double)(1 - υ2.GetElementAtAsdecimal(
                                        ΛIndexElement)))
                       *
                       (decimal)Math.Pow(
                           Math.Sqrt(
                               (double)VHat.GetElementAtAsdecimal(
                                   ΛIndexElement)),
                           -1)
                       *
                       (decimal)varianceΦ.GetElementAtAsdecimal(
                           sIndexElement,
                           lIndexElement,
                           ΛIndexElement)));
        }