Esempio n. 1
0
        public double density(
            double tStart, double tEnd,
            double stateStart, double stateEnd)
        {
            double mean  = (Mu - 0.5 * Sigma * Sigma) * (tEnd - tStart);
            double sigma = Sigma * Math.Sqrt(tEnd - tStart);

            return(LogNormal.PDF(mean, sigma, stateEnd / stateStart));
        }
Esempio n. 2
0
        public void ValidateEntropy(
            [Values(-1.000000, -1.000000, -1.000000, -1.000000, -0.100000, -0.100000, -0.100000, -0.100000, 0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 5.500000, 5.500000, 5.500000, 5.500000, 3.0)] double mu,
            [Values(0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.0)] double sigma,
            [Values(-1.8836465597893728867265104870209210873020761202386, 0.82440364131283712375834285186996677643338789710028, 1.335229265078827806963856948173628711311498693546, 2.1236866254430979764250411929125703716076041932149, -0.9836465597893728922776256101467037894202344606927, 1.7244036413128371182072277287441840743152295566462, 2.2352292650788278014127418250478460091933403530919, 3.0236866254430979708739260697867876694894458527608, -0.7836465597893728811753953638951383851839177797845, 1.9244036413128371293094579749957494785515462375544, 2.4352292650788278125149720712994114134296570340001, 3.223686625443097981976156316038353073725762533669, 0.6163534402106271132734895129790789126979238797614, 3.3244036413128371237583428518699667764333878971003, 3.835229265078827806963856948173628711311498693546, 4.6236866254430979764250411929125703716076041932149, 1.6163534402106271132734895129790789126979238797614, 4.3244036413128371237583428518699667764333878971003, 4.835229265078827806963856948173628711311498693546, 5.6236866254430979764250411929125703716076041932149, 4.6163534402106271132734895129790789126979238797614, 7.3244036413128371237583428518699667764333878971003, 7.835229265078827806963856948173628711311498693546, 8.6236866254430979764250411929125703716076041932149, Double.NegativeInfinity)] double entropy)
        {
            var n = new LogNormal(mu, sigma);

            AssertHelpers.AlmostEqual(entropy, n.Entropy, 14);
        }
        public WorkTimeGenerator(int seed, double deviation, int simNumber)
        {
            var source = new Random(Seed: seed
                                    //TODO WARUM?
                                    //+ simNumber
                                    );

            _distribution = new LogNormal(mu: 0, sigma: deviation, randomSource: source);
        }
Esempio n. 4
0
        public void ValidateCumulativeDistribution(
            [Values(-0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000)] double mu,
            [Values(0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000)] double sigma,
            [Values(-0.100000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000)] double x,
            [Values(0.0, 0.0, 0.0000000015011556178148777579869633555518882664666520593658, 0.10908001076375810900224507908874442583171381706127, 0.070999149762464508991968731574953594549291668468349, 0.34626224992888089297789445771047690175505847991946, 0.46728530589487698517090261668589508746353129242404, 0.18914969879695093477606645992572208111152994999076, 0.40622798321378106125020505907901206714868922279347, 0.48035707589956665425068652807400957345208517749893, 0.0, 0.0, 0.0, 0.005621455876973168709588070988239748831823850202953, 0.07185716187918271235246980951571040808235628115265, 0.12532699044614938400496547188720940854423187977236, 0.064125647996943514411570834861724406903677144126117, 0.19017302281590810871719754032332631806011441356498, 0.24533064397555500690927047163085419096928289095201, 0.0, 0.0, 0.0, 0.00068304052220788502001572635016579586444611070077399, 0.016636862816580533038130583128179878924863968664206, 0.034729001282904174941366974418836262996834852343018, 0.027363708266690978870139978537188410215717307180775, 0.10075543423327634536450625420610429181921642201567, 0.13802019192453118732001307556787218421918336849121)] double f)
        {
            var n = new LogNormal(mu, sigma);

            AssertHelpers.AlmostEqual(f, n.CumulativeDistribution(x), 8);
        }
        private static void DeterminationOfEdgeWeights(ProductStructureInput inputParameters, ProductStructure productStructure, XRandom rng)
        {
            var logNormalDistribution = LogNormal.WithMeanVariance(inputParameters.MeanIncomingMaterialAmount,
                                                                   Math.Pow(inputParameters.StdDevIncomingMaterialAmount, 2), rng.GetRng());

            foreach (var edge in productStructure.Edges)
            {
                edge.Weight = logNormalDistribution.Sample();
            }
        }
Esempio n. 6
0
        public void ValidateDensity(
            [Values(-0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000)] double mu,
            [Values(0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000)] double sigma,
            [Values(-0.100000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000)] double x,
            [Values(0.0, 1.7968349035073582236359415565799753846986440127816e-104, 0.00000018288923328441197822391757965928083462391836798722, 2.3363114904470413709866234247494393485647978367885, 0.90492497850024368541682348133921492204585092983646, 0.49191985207660942803818797602364034466489243416574, 0.33133347214343229148978298237579567194870525187207, 1.0824698632626565182080576574958317806389057196768, 0.31029619474753883558901295436486123689563749784867, 0.19922929916156673799861939824205622734205083805245, 4.1070141770545881694056265342787422035256248474059e-313, 2.8602688726477103843476657332784045661507239533567e-104, 1.6670425710002183246335601541889400558525870482613e-64, 0.10698412103361841220076392503406214751353235895732, 0.18266125308224685664142384493330155315630876975024, 0.17185785323404088913982425377565512294017306418953, 0.50186885259059181992025035649158160252576845315332, 0.21721369314437986034957451699565540205404697589349, 0.15729636000661278918949298391170443742675565300598, 5.6836826548848916385760779034504046896805825555997e-500, 3.1225608678589488061206338085285607881363155340377e-221, 4.6994713794671660918554320071312374073172560048297e-161, 0.015806486291412916772431170442330946677601577502353, 0.055184331257528847223852028950484131834529030116388, 0.063982134749859504449658286955049840393511776984362, 0.25212505662402617595900822552548977822542300480086, 0.14117186955911792460646517002386088579088567275401, 0.11021452580363707866161369621432656293405065561317)] double p)
        {
            var n = new LogNormal(mu, sigma);

            AssertHelpers.AlmostEqual(p, n.Density(x), 14);
        }
Esempio n. 7
0
        public void ValidateDensityLn(
            [Values(-0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000)] double mu,
            [Values(0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000)] double sigma,
            [Values(-0.100000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000)] double x,
            [Values(Double.NegativeInfinity, -238.88282294119596467794686179588610665317241097599, -15.514385149961296196003163062199569075052113039686, 0.84857339958981283964373051826407417105725729082041, -0.099903235403144611051953094864849327288457482212211, -0.70943947804316122682964396008813828577195771418027, -1.1046299420497998262946038709903250420774183529995, 0.07924534056485078867266307735371665927517517183681, -1.1702279707433794860424967893989374511050637417043, -1.6132988605030400828957768752511536087538109996183, -719.29643782024317312262673764204041218720576249741, -238.41793403955250272430898754048547661932857086122, -146.85439481068371057247137024006716189469284256628, -2.2350748570877992856465076624973458117562108140674, -1.7001219175524556705452882616787223585705662860012, -1.7610875785399045023354101841009649273236721172008, -0.68941644324162489418137656699398207513321602763104, -1.5268736489667254857801287379715477173125628275598, -1.8496236096394777662704671479709839674424623547308, -1149.5549471196476523788026360929146688367845019398, -507.73265209554698134113704985174959301922196605736, -369.16874994210463740474549611573497379941224077335, -4.1473348984184862316495477617980296904955324113457, -2.8970762200235424747307247601045786110485663457169, -2.7491513791239977024488074547907467152956602019989, -1.3778300581206721947424710027422282714793718026513, -1.9577771978563167352868858774048559682046428490575, -2.2053265778497513183112901654193054111123780652581)] double p)
        {
            var n = new LogNormal(mu, sigma);

            AssertHelpers.AlmostEqual(p, n.DensityLn(x), 14);
        }
Esempio n. 8
0
 internal static LineSeries CreateLineSeries(
     LogNormal logNormal,
     double lower,
     double upper,
     IList <OxyColor> defaultColors
     ) =>
 CreateLineSeries(
     logNormal,
     lower,
     upper,
     defaultColors,
     d => logNormal.InverseCumulativeDistribution(d),
     InterpolationAlgorithms.CatmullRomSpline
     );
Esempio n. 9
0
        // TODO (Cianan): implement logic paths for when user changes mu and sigma vs. mean and variance
        private void UpdateMeanAndVariance(double mu, double sigma, out bool sigmaCorrectedToZero, out double mean,
                                           out double variance)
        {
            sigmaCorrectedToZero = false;
            if (sigma < 0)
            {
                sigma = 0;
                sigmaCorrectedToZero = true;
            }

            var logNormalDist = new LogNormal(mu, sigma);

            variance = logNormalDist.Variance;
            mean     = logNormalDist.Mean;
        }
Esempio n. 10
0
        public PortfolioPath(int yearsUntilRetirement, double expectedReturn, double variance, double initialPortfolioValue, double annualContribution, double incomeDraw, int yearsPlannedRetirement)
        {
            this.folioReturn           = expectedReturn;
            this.folioStDev            = Math.Sqrt(variance) / 100;
            this.annualContribution    = annualContribution;
            this.incomeDraw            = incomeDraw;
            this.initialPortfolioValue = initialPortfolioValue;
            this.retirement            = yearsUntilRetirement;
            this.nSteps             = retirement + yearsPlannedRetirement;
            this.portfolioValueList = new List <decimal>();
            this.portfolioValueList.Add((decimal)initialPortfolioValue);
            LogNormal            lognormal = LogNormal.WithMuSigma(folioReturn, folioStDev);
            IEnumerable <double> returns   = lognormal.Samples().Take(nSteps);

            this.endingPortfolioValue = returns.Aggregate(initialPortfolioValue, ComputeNextPortfolioValue);
        }
Esempio n. 11
0
        public LogNormalSizeDistribution(Random rndGen, IAggregateFormationConfig config)
        {
            _rndGen = rndGen;
            _config = config;

            _logNormal = new LogNormal(Mu, _config.StdPPRadius, rndGen);

            ComputeMeans();
            Mean = config.RadiusMeanCalculationMethod switch
            {
                MeanMethod.Arithmetic => _arithmeticMean,
                MeanMethod.Sauter => _sauterMean,
                MeanMethod.Geometric => _geometricMean,
                _ => _geometricMean,
            };
        }
Esempio n. 12
0
        public void TestMeanAndVariacneConsistency()
        {
            const int   numSamples = 100000;
            double      mean, stdev;
            RunningStat rs        = new RunningStat();
            Random      defaultrs = new Random();
            LogNormal   logNormal = new LogNormal();

            rs.Clear();
            mean = 2; stdev = 5;

            for (int i = 0; i < numSamples; ++i)
            {
                logNormal.Mean = mean;
                logNormal.StandardDeviation = stdev;
                rs.Push(logNormal.Sample(defaultrs));
            }
            PrintResult.CompareMeanAndVariance("logNormal", mean, stdev * stdev, rs.Mean(), rs.Variance());
        }
Esempio n. 13
0
 /// <summary>
 /// The estimated driving time between stations.
 /// This could either be a simplified version for validation, or a lognormal distribution.
 /// </summary>
 /// <param name="averageForPart">Average driving time for this section</param>
 /// <returns></returns>
 public static int drivingTime(int averageForPart)
 {
     if (Config.c.simplifiedDrivingTimes)
     {
         var x = DiscreteUniform.Sample(0, 100);
         if (x <= 40)
         {
             return((int)(0.8 * averageForPart));
         }
         if (x <= 70)
         {
             return(averageForPart);
         }
         if (x <= 90)
         {
             return((int)(1.2 * averageForPart));
         }
         return((int)(1.4 * averageForPart));
     }
     return((int)LogNormal.Sample(Math.Log(averageForPart), Config.c.sdDrivingTimes));
 }
Esempio n. 14
0
        public void TestMeanAndVariacneConsistency_MuSigma()
        {
            const int   numSamples = 100000;
            double      mean, stdev;
            RunningStat rs        = new RunningStat();
            Random      defaultrs = new Random();
            LogNormal   logNormal = new LogNormal();

            rs.Clear();
            mean = 2; stdev = 5;
            var muTemp    = Math.Log(mean) - 0.5 * Math.Log(1 + stdev * stdev / mean / mean);
            var sigmaTemp = Math.Sqrt(Math.Log(1 + stdev * stdev / mean / mean));

            for (int i = 0; i < numSamples; ++i)
            {
                logNormal.Mu    = muTemp;
                logNormal.Sigma = sigmaTemp;

                rs.Push(logNormal.Sample(defaultrs));
            }
            PrintResult.CompareMeanAndVariance("logNormal", mean, stdev * stdev, rs.Mean(), rs.Variance());
        }
Esempio n. 15
0
        public static List <double> TestUniformDistribution(int amount)
        {
            /*var samples = new List<double>();
             * for (var i = 0; i < amount; i++)
             * {
             * samples.Add(MathNet.Numerics.Distributions.DiscreteUniform.Sample(0, 1000)/1000.00);
             * }
             * return samples;*/
            var samples = new List <double>();
            var dist    = new LogNormal(0, 0.125);

            for (int i = 0; i < amount; i++)
            {
                var sample = dist.Sample();
                var round  = Math.Round(sample * 5, MidpointRounding.AwayFromZero);
                if (sample < 5 || sample > 5)
                {
                    var a = 1;
                }
                samples.Add((int)round);
            }
            return(samples);
        }
Esempio n. 16
0
 public void CanSetSigma(double sigma)
 {
     var n = new LogNormal(1.0, 2.0);
     n.Sigma = sigma;
 }
Esempio n. 17
0
 public void ValidateMode(
     [Values(-1.000000, -1.000000, -1.000000, -1.000000, -0.100000, -0.100000, -0.100000, -0.100000, 0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 5.500000, 5.500000, 5.500000, 5.500000)] double mu, 
     [Values(0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000)] double sigma, 
     [Values(0.36421897957152331652213191863106773137983085909534, 0.03877420783172200988689983526759614326014406193602, 0.0007101743888425490635846003705775444086763023873619, 0.000000000000026810038677818032221548731163905979029274677187036, 0.89583413529652823774737070060865897390995185639633, 0.095369162215549610417813418326627245539514227574881, 0.0017467471362611196181003627521060283221112106850165, 0.00000000000006594205454219929159167575814655534255162059017114, 1.0941742837052103542285651753780976842292770841345, 0.11648415777349696821514223131929465848700730137808, 0.0021334817700377079925027678518795817076296484352472, 0.000000000000080541807296590798973741710866097756565304960216803, 4.4370955190036645692996309927420381428715912422597, 0.47236655274101470713804655094326791297020357913648, 0.008651695203120634177071503957250390848166331197708, 0.00000000000032661313427874471360158184468030186601222739665225, 12.061276120444720299113038763305617245808510584994, 1.2840254166877414840734205680624364583362808652815, 0.023517745856009108236151185100432939470067655273072, 0.00000000000088782654784596584473099190326928541185172970391855, 242.2572068579541371904816252345031593584721473492, 25.790339917193062089080107669377221876655268848954, 0.47236655274101470713804655094326791297020357913648, 0.000000000017832472908146389493511850431527026413424899198327)] double mode)
 {
     var n = new LogNormal(mu, sigma);
     Assert.AreEqual(mode, n.Mode);
 }
Esempio n. 18
0
 public void ValidateCumulativeDistribution(
     [Values(-0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000)] double mu, 
     [Values(0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000)] double sigma, 
     [Values(-0.100000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000)] double x, 
     [Values(0.0, 0.0, 0.0000000015011556178148777579869633555518882664666520593658, 0.10908001076375810900224507908874442583171381706127, 0.070999149762464508991968731574953594549291668468349, 0.34626224992888089297789445771047690175505847991946, 0.46728530589487698517090261668589508746353129242404, 0.18914969879695093477606645992572208111152994999076, 0.40622798321378106125020505907901206714868922279347, 0.48035707589956665425068652807400957345208517749893, 0.0, 0.0, 0.0, 0.005621455876973168709588070988239748831823850202953, 0.07185716187918271235246980951571040808235628115265, 0.12532699044614938400496547188720940854423187977236, 0.064125647996943514411570834861724406903677144126117, 0.19017302281590810871719754032332631806011441356498, 0.24533064397555500690927047163085419096928289095201, 0.0, 0.0, 0.0, 0.00068304052220788502001572635016579586444611070077399, 0.016636862816580533038130583128179878924863968664206, 0.034729001282904174941366974418836262996834852343018, 0.027363708266690978870139978537188410215717307180775, 0.10075543423327634536450625420610429181921642201567, 0.13802019192453118732001307556787218421918336849121)] double f)
 {
     var n = new LogNormal(mu, sigma);
     AssertHelpers.AlmostEqual(f, n.CumulativeDistribution(x), 8);
 }
Esempio n. 19
0
        public void CanEstimateParameters(double mu, double sigma)
        {
            var original = new LogNormal(mu, sigma, new Random(100));
            var estimated = LogNormal.Estimate(original.Samples().Take(10000));

            AssertHelpers.AlmostEqual(mu, estimated.Mu, 2);
            AssertHelpers.AlmostEqual(sigma, estimated.Sigma, 2);
        }
Esempio n. 20
0
 public void ValidateMean(
     [Values(-1.000000, -1.000000, -1.000000, -1.000000, -0.100000, -0.100000, -0.100000, -0.100000, 0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 5.500000, 5.500000, 5.500000, 5.500000)] double mu, 
     [Values(0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000)] double sigma, 
     [Values(0.36972344454405898424295931933535060663729727450496, 1.1331484530668263168290072278117938725655031317452, 8.3728974881272646632047051583699874196015291437918, 1362729.1842528548177103892815156762190272224157908, 0.90937293446823141948366366799116134283184493055232, 2.7870954605658505209699655454000403395863724001622, 20.594004711196027346218102453235151379866942184579, 3351772.9412526949983798753257651403306685815830315, 1.1107106103557052433570611860384876269319432656698, 3.4041660827908192886708290528609320712960422205023, 25.153574155818364061848601838108180348672588964125, 4093864.7151726636524297378613262447736728507467499, 4.5041536302884836520306376113128094189800629942172, 13.804574186067094919261248628970575865946258844868, 102.00277308269968445339478193484494686013688925329, 16601440.057234774713918640507932346750889433699096, 12.243558965801025772304627735965552181680541950402, 37.524723159600998914070697772298569304087527691818, 277.27228452313398040814702091277144916631260200421, 45127392.833833379992911980630933945681066040228608, 245.91845567882191847293631456824227914641401674654, 753.70421255456126566058070133948176772966773355511, 5569.16270856600407442234466894967473356247174813, 906407915.01115491334464289369168840924937330105415)] double mean)
 {
     var n = new LogNormal(mu, sigma);
     AssertHelpers.AlmostEqual(mean, n.Mean, 14);
 }
Esempio n. 21
0
 public void ValidateDensityLn(
     [Values(-0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000)] double mu, 
     [Values(0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000)] double sigma, 
     [Values(-0.100000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000)] double x, 
     [Values(Double.NegativeInfinity, -238.88282294119596467794686179588610665317241097599, -15.514385149961296196003163062199569075052113039686, 0.84857339958981283964373051826407417105725729082041, -0.099903235403144611051953094864849327288457482212211, -0.70943947804316122682964396008813828577195771418027, -1.1046299420497998262946038709903250420774183529995, 0.07924534056485078867266307735371665927517517183681, -1.1702279707433794860424967893989374511050637417043, -1.6132988605030400828957768752511536087538109996183, -719.29643782024317312262673764204041218720576249741, -238.41793403955250272430898754048547661932857086122, -146.85439481068371057247137024006716189469284256628, -2.2350748570877992856465076624973458117562108140674, -1.7001219175524556705452882616787223585705662860012, -1.7610875785399045023354101841009649273236721172008, -0.68941644324162489418137656699398207513321602763104, -1.5268736489667254857801287379715477173125628275598, -1.8496236096394777662704671479709839674424623547308, -1149.5549471196476523788026360929146688367845019398, -507.73265209554698134113704985174959301922196605736, -369.16874994210463740474549611573497379941224077335, -4.1473348984184862316495477617980296904955324113457, -2.8970762200235424747307247601045786110485663457169, -2.7491513791239977024488074547907467152956602019989, -1.3778300581206721947424710027422282714793718026513, -1.9577771978563167352868858774048559682046428490575, -2.2053265778497513183112901654193054111123780652581)] double p)
 {
     var n = new LogNormal(mu, sigma);
     AssertHelpers.AlmostEqual(p, n.DensityLn(x), 14);
 }
Esempio n. 22
0
        public void SetSigmaFailsWithNegativeSigma()
        {
            var n = new LogNormal(1.0, 2.0);

            Assert.Throws <ArgumentOutOfRangeException>(() => n.Sigma = -1.0);
        }
Esempio n. 23
0
 public void CanSetMu(double mu)
 {
     var n = new LogNormal(1.0, 2.0);
     n.Mu = mu;
 }
Esempio n. 24
0
 public void ValidateDensityLn(double mu, double sigma, double x, double p)
 {
     var n = new LogNormal(mu, sigma);
     AssertHelpers.AlmostEqual(p, n.DensityLn(x), 14);
 }
Esempio n. 25
0
 public void ValidateSkewness(
     [Values(-1.000000, -1.000000, -1.000000, -1.000000, -0.100000, -0.100000, -0.100000, -0.100000, 0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 5.500000, 5.500000, 5.500000, 5.500000)] double mu, 
     [Values(0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000)] double sigma, 
     [Values(0.30175909933883402945387113824982918009810212213629, 33.46804679732172529147579024311650645764144530123, 11824.007933610287521341659465200553739278936344799, 50829064464591483629.132631635472412625371367420496, 0.30175909933883402945387113824982918009810212213629, 33.46804679732172529147579024311650645764144530123, 11824.007933610287521341659465200553739278936344799, 50829064464591483629.132631635472412625371367420496, 0.30175909933883402945387113824982918009810212213629, 33.46804679732172529147579024311650645764144530123, 11824.007933610287521341659465200553739278936344799, 50829064464591483629.132631635472412625371367420496, 0.30175909933883402945387113824982918009810212213629, 33.46804679732172529147579024311650645764144530123, 11824.007933610287521341659465200553739278936344799, 50829064464591483629.132631635472412625371367420496, 0.30175909933883402945387113824982918009810212213629, 33.46804679732172529147579024311650645764144530123, 11824.007933610287521341659465200553739278936344799, 50829064464591483629.132631635472412625371367420496, 0.30175909933883402945387113824982918009810212213629, 33.46804679732172529147579024311650645764144530123, 11824.007933610287521341659465200553739278936344799, 50829064464591483629.132631635472412625371367420496)] double skewness)
 {
     var n = new LogNormal(mu, sigma);
     AssertHelpers.AlmostEqual(skewness, n.Skewness, 14);
 }
Esempio n. 26
0
 public void ValidateCumulativeDistribution(double mu, double sigma, double x, double f)
 {
     var n = new LogNormal(mu, sigma);
     AssertHelpers.AlmostEqual(f, n.CumulativeDistribution(x), 8);
 }
Esempio n. 27
0
 public void SetSigmaFailsWithNegativeSigma()
 {
     var n = new LogNormal(1.0, 2.0);
     n.Sigma = -1.0;
 }
Esempio n. 28
0
 public void LogNormalCreateFailsWithBadParameters(double mu, double sigma)
 {
     var n = new LogNormal(mu, sigma);
 }
Esempio n. 29
0
 public void CanSample()
 {
     var n = new LogNormal(1.0, 2.0);
     var d = n.Sample();
 }
Esempio n. 30
0
        public void ValidateSkewness(double mu, double sigma, double skewness)
        {
            var n = new LogNormal(mu, sigma);

            AssertHelpers.AlmostEqual(skewness, n.Skewness, 14);
        }
Esempio n. 31
0
 public void CanSampleSequence()
 {
     var n = new LogNormal(1.0, 2.0);
     var ied = n.Samples();
     var e = ied.Take(5).ToArray();
 }
Esempio n. 32
0
        public void ValidateMedian(double mu, double sigma, double median)
        {
            var n = new LogNormal(mu, sigma);

            Assert.AreEqual(median, n.Median);
        }
Esempio n. 33
0
 public void ValidateMedian(
     [Values(-1.000000, -1.000000, -1.000000, -1.000000, -0.100000, -0.100000, -0.100000, -0.100000, 0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 5.500000, 5.500000, 5.500000, 5.500000)] double mu, 
     [Values(0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000)] double sigma, 
     [Values(0.36787944117144232159552377016146086744581113103177, 0.36787944117144232159552377016146086744581113103177, 0.36787944117144232159552377016146086744581113103177, 0.36787944117144232159552377016146086744581113103177, 0.90483741803595956814139238421693559530906465375738, 0.90483741803595956814139238421693559530906465375738, 0.90483741803595956814139238421693559530906465375738, 0.90483741803595956814139238421693559530906465375738, 1.1051709180756476309466388234587796577416634163742, 1.1051709180756476309466388234587796577416634163742, 1.1051709180756476309466388234587796577416634163742, 1.1051709180756476309466388234587796577416634163742, 4.4816890703380648226020554601192758190057498683697, 4.4816890703380648226020554601192758190057498683697, 4.4816890703380648226020554601192758190057498683697, 4.4816890703380648226020554601192758190057498683697, 12.182493960703473438070175951167966183182767790063, 12.182493960703473438070175951167966183182767790063, 12.182493960703473438070175951167966183182767790063, 12.182493960703473438070175951167966183182767790063, 244.6919322642203879151889495118393501842287101075, 244.6919322642203879151889495118393501842287101075, 244.6919322642203879151889495118393501842287101075, 244.6919322642203879151889495118393501842287101075)] double median)
 {
     var n = new LogNormal(mu, sigma);
     Assert.AreEqual(median, n.Median);
 }
Esempio n. 34
0
        public void ValidateMinimum()
        {
            var n = new LogNormal(1.0, 2.0);

            Assert.AreEqual(0.0, n.Minimum);
        }
Esempio n. 35
0
 public void ValidateEntropy(
     [Values(-1.000000, -1.000000, -1.000000, -1.000000, -0.100000, -0.100000, -0.100000, -0.100000, 0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 5.500000, 5.500000, 5.500000, 5.500000, 3.0)] double mu, 
     [Values(0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.100000, 1.500000, 2.500000, 5.500000, 0.0)] double sigma, 
     [Values(-1.8836465597893728867265104870209210873020761202386, 0.82440364131283712375834285186996677643338789710028, 1.335229265078827806963856948173628711311498693546, 2.1236866254430979764250411929125703716076041932149, -0.9836465597893728922776256101467037894202344606927, 1.7244036413128371182072277287441840743152295566462, 2.2352292650788278014127418250478460091933403530919, 3.0236866254430979708739260697867876694894458527608, -0.7836465597893728811753953638951383851839177797845, 1.9244036413128371293094579749957494785515462375544, 2.4352292650788278125149720712994114134296570340001, 3.223686625443097981976156316038353073725762533669, 0.6163534402106271132734895129790789126979238797614, 3.3244036413128371237583428518699667764333878971003, 3.835229265078827806963856948173628711311498693546, 4.6236866254430979764250411929125703716076041932149, 1.6163534402106271132734895129790789126979238797614, 4.3244036413128371237583428518699667764333878971003, 4.835229265078827806963856948173628711311498693546, 5.6236866254430979764250411929125703716076041932149, 4.6163534402106271132734895129790789126979238797614, 7.3244036413128371237583428518699667764333878971003, 7.835229265078827806963856948173628711311498693546, 8.6236866254430979764250411929125703716076041932149, Double.NegativeInfinity)] double entropy)
 {
     var n = new LogNormal(mu, sigma);
     AssertHelpers.AlmostEqual(entropy, n.Entropy, 14);
 }
Esempio n. 36
0
 public void CanSampleStatic()
 {
     LogNormal.Sample(new Random(), 0.0, 1.0);
 }
Esempio n. 37
0
 public void ValidateDensity(
     [Values(-0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, -0.100000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000, 2.500000)] double mu, 
     [Values(0.100000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000, 0.100000, 0.100000, 0.100000, 1.500000, 1.500000, 1.500000, 2.500000, 2.500000, 2.500000)] double sigma, 
     [Values(-0.100000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000, 0.100000, 0.500000, 0.800000)] double x, 
     [Values(0.0, 1.7968349035073582236359415565799753846986440127816e-104, 0.00000018288923328441197822391757965928083462391836798722, 2.3363114904470413709866234247494393485647978367885, 0.90492497850024368541682348133921492204585092983646, 0.49191985207660942803818797602364034466489243416574, 0.33133347214343229148978298237579567194870525187207, 1.0824698632626565182080576574958317806389057196768, 0.31029619474753883558901295436486123689563749784867, 0.19922929916156673799861939824205622734205083805245, 4.1070141770545881694056265342787422035256248474059e-313, 2.8602688726477103843476657332784045661507239533567e-104, 1.6670425710002183246335601541889400558525870482613e-64, 0.10698412103361841220076392503406214751353235895732, 0.18266125308224685664142384493330155315630876975024, 0.17185785323404088913982425377565512294017306418953, 0.50186885259059181992025035649158160252576845315332, 0.21721369314437986034957451699565540205404697589349, 0.15729636000661278918949298391170443742675565300598, 5.6836826548848916385760779034504046896805825555997e-500, 3.1225608678589488061206338085285607881363155340377e-221, 4.6994713794671660918554320071312374073172560048297e-161, 0.015806486291412916772431170442330946677601577502353, 0.055184331257528847223852028950484131834529030116388, 0.063982134749859504449658286955049840393511776984362, 0.25212505662402617595900822552548977822542300480086, 0.14117186955911792460646517002386088579088567275401, 0.11021452580363707866161369621432656293405065561317)] double p)
 {
     var n = new LogNormal(mu, sigma);
     AssertHelpers.AlmostEqual(p, n.Density(x), 14);
 }
Esempio n. 38
0
 public void FailSampleStatic()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => { var d = LogNormal.Sample(new Random(), 0.0, -1.0); });
 }
Esempio n. 39
0
 public void SetSigmaFailsWithNegativeSigma()
 {
     var n = new LogNormal(1.0, 2.0);
     Assert.Throws<ArgumentOutOfRangeException>(() => n.Sigma = -1.0);
 }
Esempio n. 40
0
        public void CanSample()
        {
            var n = new LogNormal(1.0, 2.0);

            n.Sample();
        }
Esempio n. 41
0
 public void ValidateEntropy(double mu, double sigma, double entropy)
 {
     var n = new LogNormal(mu, sigma);
     AssertHelpers.AlmostEqual(entropy, n.Entropy, 14);
 }
Esempio n. 42
0
 public void CanCreateLogNormal([Values(0.0, 10.0, -5.0)] double mu, [Values(0.0, 0.1, 1.0, 10.0, 100.0, Double.PositiveInfinity)] double sigma)
 {
     var n = new LogNormal(mu, sigma);
     Assert.AreEqual(mu, n.Mu);
     Assert.AreEqual(sigma, n.Sigma);
 }
 public void FailSampleSequenceStatic()
 {
     Assert.That(() => { var ied = LogNormal.Samples(new Random(0), 0.0, -1.0).First(); }, Throws.ArgumentException);
 }
Esempio n. 44
0
 public void ValidateMaximum()
 {
     var n = new LogNormal(1.0, 2.0);
     Assert.AreEqual<double>(System.Double.PositiveInfinity, n.Maximum);
 }
Esempio n. 45
0
        public void ValidateEntropy(double mu, double sigma, double entropy)
        {
            var n = new LogNormal(mu, sigma);

            AssertHelpers.AlmostEqual(entropy, n.Entropy, 14);
        }
Esempio n. 46
0
 public void ValidateMean(double mu, double sigma, double mean)
 {
     var n = new LogNormal(mu, sigma);
     AssertHelpers.AlmostEqual(mean, n.Mean, 14);
 }
Esempio n. 47
0
        public void ValidateMode(double mu, double sigma, double mode)
        {
            var n = new LogNormal(mu, sigma);

            Assert.AreEqual(mode, n.Mode);
        }
Esempio n. 48
0
 public void ValidateMedian(double mu, double sigma, double median)
 {
     var n = new LogNormal(mu, sigma);
     Assert.AreEqual<double>(median, n.Median);
 }
Esempio n. 49
0
        public void ValidateMean(double mu, double sigma, double mean)
        {
            var n = new LogNormal(mu, sigma);

            AssertHelpers.AlmostEqual(mean, n.Mean, 14);
        }
Esempio n. 50
0
 public void ValidateMinimum()
 {
     var n = new LogNormal(1.0, 2.0);
     Assert.AreEqual<double>(0.0, n.Minimum);
 }
Esempio n. 51
0
        public void ValidateMaximum()
        {
            var n = new LogNormal(1.0, 2.0);

            Assert.AreEqual(Double.PositiveInfinity, n.Maximum);
        }
Esempio n. 52
0
 public void ValidateMode(double mu, double sigma, double mode)
 {
     var n = new LogNormal(mu, sigma);
     Assert.AreEqual<double>(mode, n.Mode);
 }
Esempio n. 53
0
        public void CanSampleSequenceStatic()
        {
            var ied = LogNormal.Samples(new Random(), 0.0, 1.0);

            ied.Take(5).ToArray();
        }
Esempio n. 54
0
 public void ValidateSkewness(double mu, double sigma, double skewness)
 {
     var n = new LogNormal(mu, sigma);
     AssertHelpers.AlmostEqual(skewness, n.Skewness, 14);
 }
Esempio n. 55
0
 public void FailSampleSequenceStatic()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => { var ied = LogNormal.Samples(new Random(), 0.0, -1.0).First(); });
 }
Esempio n. 56
0
 public void ValidateToString()
 {
     var n = new LogNormal(1.0, 2.0);
     Assert.AreEqual<string>("LogNormal(Mu = 1, Sigma = 2)", n.ToString());
 }
Esempio n. 57
0
        public void ValidateToString()
        {
            var n = new LogNormal(1d, 2d);

            Assert.AreEqual("LogNormal(μ = 1, σ = 2)", n.ToString());
        }
Esempio n. 58
0
 public void CanCreateLogNormal(double mu, double sigma)
 {
     var n = new LogNormal(mu, sigma);
     Assert.AreEqual<double>(mu, n.Mu);
     Assert.AreEqual<double>(sigma, n.Sigma);
 }