정규 분포. Implements the univariate Normal (or Gaussian) distribution. For details about this distribution, see Wikipedia - Normal distribution.

The distribution will use the System.Random by default. Users can get/set the random number generator by using the RandomSource property.

The statistics classes will check all the incoming parameters whether they are in the allowed range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters to false, all parameter checks can be turned off.

Наследование: IContinuousDistribution
Пример #1
0
        public void ValidateDistributionPropertiesByStDev([Values(-0.0, 0.0, 0.1, 1.0, 10.0, Double.PositiveInfinity)] double stdev) {
            var normal = new Normal(1.0, stdev);

            normal.Entropy.Should().Be(Math.Log(normal.StDev) + MathTool.LnSqrtPi2E);
            normal.Skewness.Should().Be(0.0);
        }
Пример #2
0
        public void ValidateDistributionPropertiesByMean([Values(-0.0, 0.0, 0.1, 1.0, 10.0, Double.PositiveInfinity)] double mean) {
            var normal = new Normal(mean, 1.0);

            normal.Mean.Should().Be(mean);
            normal.Median.Should().Be(mean);

            normal.Minumum.Should().Be(double.NegativeInfinity);
            normal.Maximum.Should().Be(double.PositiveInfinity);
        }
Пример #3
0
 public void SetStDevFailsWithNegativeStDev() {
     var n = new Normal();
     Assert.Throws<InvalidOperationException>(() => n.StDev = -1.0);
 }
Пример #4
0
 public void SetVarianceFailsWithNegativeVariance() {
     var n = new Normal();
     Assert.Throws<InvalidOperationException>(() => n.Variance = -1.0);
 }
Пример #5
0
 public void SetPrecisionFailsWithNegativePrecision() {
     var n = new Normal();
     Assert.Throws<InvalidOperationException>(() => n.Precision = -1.0);
 }
Пример #6
0
 public void CreateNormal([Values(0.0, 10.0, -5.0)] double mean,
                          [Values(0.0, 0.1, 1.0, 10.0, 100.0, double.PositiveInfinity)] double stdev) {
     var normal = new Normal(mean, stdev);
     normal.Mean.Should().Be(mean);
     normal.StDev.Should().Be(stdev);
 }
Пример #7
0
        public void CreateStandardNormalDistribution() {
            var normal = new Normal();

            normal.Mean.Should().Be(0.0);
            normal.StDev.Should().Be(1.0);
        }