Accord.Statistics.Distributions.Univariate.ShapiroWilkDistribution.ToString C# (CSharp) Method

ToString() public method

Returns a System.String that represents this instance.
public ToString ( string format, IFormatProvider formatProvider ) : string
format string
formatProvider IFormatProvider
return string
        public override string ToString(string format, IFormatProvider formatProvider)
        {
            return String.Format("W(x; n = {0})",
                NumberOfSamples.ToString(format, formatProvider));
        }

Usage Example

コード例 #1
0
        public void ConstructorTest3()
        {
            var sw = new ShapiroWilkDistribution(samples: 12);

            double mean = sw.Mean;     // 0.940148636841248
            double median = sw.Median; // 0.940148636841248
            double mode = sw.Mode;     // 0.940148636841248

            double cdf = sw.DistributionFunction(x: 0.42); // 0.999995183174473
            double pdf = sw.ProbabilityDensityFunction(x: 0.42); // 0.000043477460596194137
            double lpdf = sw.LogProbabilityDensityFunction(x: 0.42); // -10.043267901368219

            double ccdf = sw.ComplementaryDistributionFunction(x: 0.42); // 0.0000048168255270011394
            double icdf = sw.InverseDistributionFunction(p: cdf); // 0.42000002275671627

            double hf = sw.HazardFunction(x: 0.42); // 9.0261647121070521
            double chf = sw.CumulativeHazardFunction(x: 0.42); // 12.243395451233496

            string str = sw.ToString(CultureInfo.InvariantCulture); // W(x; n = 12)

            Assert.AreEqual(0.940148636841248, mean);
            Assert.AreEqual(0.940148636841248, mode);
            Assert.AreEqual(0.940148636841248, median, 1e-8);
            Assert.AreEqual(12.243395451233496, chf);
            Assert.AreEqual(0.999995183174473, cdf);
            Assert.AreEqual(0.000043477460596194137, pdf);
            Assert.AreEqual(-10.043267901368219, lpdf);
            Assert.AreEqual(9.0261647121070521, hf);
            Assert.AreEqual(0.0000048168255270011394, ccdf);
            Assert.AreEqual(0.42000002275671627, icdf, 1e-8);
            Assert.AreEqual("W(x; n = 12)", str);

            var range1 = sw.GetRange(0.95);
            Assert.AreEqual(0.8607805197002204, range1.Min);
            Assert.AreEqual(0.97426955790462533, range1.Max);

            var range2 = sw.GetRange(0.99);
            Assert.AreEqual(0.80248479750351542, range2.Min);
            Assert.AreEqual(0.98186388183806661, range2.Max);

            var range3 = sw.GetRange(0.01);
            Assert.AreEqual(0.80248479750351542, range3.Min);
            Assert.AreEqual(0.98186388183806661, range3.Max);
        }
All Usage Examples Of Accord.Statistics.Distributions.Univariate.ShapiroWilkDistribution::ToString