/// Create an instance of the receiver with parameters estimated from
 /// the given histogram using best guesses. This method can be used to
 /// find the initial values for a fit.
 /// @param h DhbScientificCurves.Histogram
 public UniformDistribution(Histogram h)
 {
     _b = h.StandardDeviation * 1.73205080756888; // sqrt(12)/2
     double c = h.Average;
     _a = c - _b;
     _b += c;
 }
 /// Create an instance of the receiver with parameters estimated from
 /// the given histogram using best guesses. This method can be used to
 /// find the initial values for a fit.
 /// @param h DhbScientificCurves.Histogram
 public TriangularDistribution(Histogram h)
 {
     _b = h.StandardDeviation * 1.73205080756888; // sqrt(12)/2
     _c = h.Average;
     _a = _c - _b;
     _b += _c;
 }
 /// Create an instance of the receiver with parameters estimated from the
 /// given histogram using best guesses. This method can be used to
 /// find the initial values for a fit.
 /// @param h DhbScientificCurves.Histogram
 /// @exception ArgumentOutOfRangeException when no suitable parameter can be found.
 public FisherTippettDistribution(Histogram h)
 {
     double beta = h.StandardDeviation;
     if (beta < 0)
         throw new ArgumentOutOfRangeException("Histogram has vanishing standard deviation");
     beta *= System.Math.Sqrt(6) / System.Math.PI;
     DefineParameters(h.Average - 0.5772156649 * beta, beta);
 }
 /// Create an instance of the receiver with parameters estimated from
 /// the given histogram using best guesses. This method can be used to
 /// find the initial values for a fit.
 /// @param h DhbScientificCurves.Histogram
 /// @exception ArgumentOutOfRangeException
 ///							when no suitable parameter can be found.
 public BetaDistribution(Histogram h)
 {
     if (h.Minimum < 0 || h.Maximum > 1)
         throw new ArgumentOutOfRangeException("Beta distribution is only defined over [0,1]");
     double average = h.Average;
     double variance = h.Variance;
     double a = ((1 - average) / variance - 1) * average;
     if (a <= 0)
         throw new ArgumentOutOfRangeException("Negative shape parameter");
     double b = (1 / average - 1) * a;
     if (b <= 0)
         throw new ArgumentOutOfRangeException("Negative shape parameter");
     DefineParameters(a, b);
 }
 /// Create an instance of the receiver with parameters estimated from
 /// the given histogram using best guesses. This method can be used to
 /// find the initial values for a fit.
 /// @param h DhbScientificCurves.Histogram
 /// @exception ArgumentOutOfRangeException
 ///							when no suitable parameter can be found.
 public WeibullDistribution(Histogram h)
 {
     if (h.Minimum < 0)
         throw new ArgumentOutOfRangeException(
                 "Weibull distribution is only defined for non-negative values");
     double average = h.Average;
     if (average <= 0)
         throw new ArgumentOutOfRangeException(
                 "Weibull distribution must have a non-negative average");
     double xMin = (h.Minimum + average) * 0.5;
     double accMin = System.Math.Log(-System.Math.Log(1 - h.CountsUpTo(xMin) / h.TotalCount));
     double xMax = (h.Maximum + average) * 0.5;
     double accMax = System.Math.Log(-System.Math.Log(1 - h.CountsUpTo(xMax) / h.TotalCount));
     double delta = accMax - accMin;
     xMin = System.Math.Log(xMin);
     xMax = System.Math.Log(xMax);
     DefineParameters(delta / (xMax - xMin),
                         System.Math.Exp((accMax * xMin - accMin * xMax) / delta));
 }
        /// Create an instance of the receiver with parameters estimated from
        /// the given histogram using best guesses. This method can be used to
        /// find the initial values for a fit.
        /// @param h Histogram
        public CauchyDistribution(Histogram h)
            : this(h.Average,
		                4 * h.Variance /System.Math.Sqrt(System.Math.PI *( h.Minimum
			  		        * h.Minimum +h.Maximum * h.Maximum ) ))
        {
        }
 //TODO: this constructor is mentioned in section 9.8.3 but it's not part of Listing 9.24 code
 public HistogrammedDistribution(Histogram histogram)
 {
     _histogram = histogram;
 }
 /// Create an instance of the receiver with parameters estimated from
 /// the given histogram using best guesses. This method can be used to
 /// find the initial values for a fit.
 /// @param h DhbScientificCurves.Histogram
 public LaplaceDistribution(Histogram h)
     : this(h.Average, System.Math.Sqrt( 0.5 * h.Variance))
 {
 }
Beispiel #9
0
 /// @return double	t-test confidence level with data accumulated 
 ///											in the supplied histogram.
 /// @param h DhbScientificCurves.Histogram
 public double TConfidenceLevel(Histogram h)
 {
     return _moments.TConfidenceLevel(h._moments);
 }