GeneralizedBetaDistribution Class 
Namespace: Accord.Statistics.Distributions.Univariate
[SerializableAttribute] public class GeneralizedBetaDistribution : UnivariateContinuousDistribution, ISampleableDistribution<double>, IDistribution<double>, IDistribution, ICloneable, IRandomNumberGenerator<double>, IFittableDistribution<double, GeneralizedBetaOptions>, IFittable<double, GeneralizedBetaOptions>, IFittable<double>, IFittableDistribution<double>
The GeneralizedBetaDistribution type exposes the following members.
Name  Description  

GeneralizedBetaDistribution(Double, Double) 
Constructs a Beta distribution defined in the
interval (0,1) with the given parameters α and β.
 
GeneralizedBetaDistribution(Double, Double, Double, Double) 
Constructs a Beta distribution defined in the
interval (a, b) with parameters α, β, a and b.

Name  Description  

Alpha 
Gets the shape parameter α (alpha)
 
Beta 
Gets the shape parameter β (beta).
 
Entropy 
Gets the entropy for this distribution.
(Overrides UnivariateContinuousDistributionEntropy.)  
Max 
Gets the maximum value B.
 
Mean 
Gets the mean for this distribution,
defined as (a + 4 * m + 6 * b).
(Overrides UnivariateContinuousDistributionMean.)  
Median 
Gets the median for this distribution.
(Inherited from UnivariateContinuousDistribution.)  
Min 
Gets the minimum value A.
 
Mode 
Gets the mode for this distribution.
(Overrides UnivariateContinuousDistributionMode.)  
Quartiles 
Gets the Quartiles for this distribution.
(Inherited from UnivariateContinuousDistribution.)  
StandardDeviation 
Gets the Standard Deviation (the square root of
the variance) for the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Support  (Overrides UnivariateContinuousDistributionSupport.)  
Variance 
Gets the variance for this distribution,
defined as ((b  a) / (k+2))²
(Overrides UnivariateContinuousDistributionVariance.) 
Name  Description  

Clone 
Creates a new object that is a copy of the current instance.
(Overrides DistributionBaseClone.)  
ComplementaryDistributionFunction 
Gets the complementary cumulative distribution function
(ccdf) for this distribution evaluated at point x.
This function is also known as the Survival function.
(Inherited from UnivariateContinuousDistribution.)  
CumulativeHazardFunction 
Gets the cumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
DistributionFunction(Double) 
Gets the cumulative distribution function (cdf) for
this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionDistributionFunction(Double).)  
DistributionFunction(Double, Double) 
Gets the cumulative distribution function (cdf) for this
distribution in the semiclosed interval (a; b] given as
P(a < X ≤ b).
(Inherited from UnivariateContinuousDistribution.)  
Equals  Determines whether the specified object is equal to the current object. (Inherited from Object.)  
Estimate(Double, Int32, Int32) 
Estimates a new Beta distribution from a set of observations.
 
Estimate(Double, Int32, Int32, GeneralizedBetaOptions) 
Estimates a new Beta distribution from a set of observations.
 
Estimate(Double, Int32, Int32, Double) 
Estimates a new Beta distribution from a set of weighted observations.
 
Estimate(Double, Int32, Int32, Double, GeneralizedBetaOptions) 
Estimates a new Beta distribution from a set of weighted observations.
 
Finalize  Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)  
Fit(Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Int32) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Double, GeneralizedBetaOptions) 
Fits the underlying distribution to a given set of observations.
 
Fit(Double, Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Overrides UnivariateContinuousDistributionFit(Double, Double, IFittingOptions).)  
Fit(Double, Int32, GeneralizedBetaOptions) 
Fits the underlying distribution to a given set of observations.
 
Fit(Double, Int32, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Overrides UnivariateContinuousDistributionFit(Double, Int32, IFittingOptions).)  
Generate 
Generates a random observation from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate.)  
Generate(Int32) 
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Generate(Int32, Double) 
Generates a random vector of observations from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate(Int32, Double).)  
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetRange 
Gets the distribution range within a given percentile.
(Inherited from UnivariateContinuousDistribution.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
GolenkoGinzburg 
Constructs a BetaPERT distribution defined in the interval (a, b)
using GolenkoGinzburg observation that the mode is often at 2/3
of the guessed interval.
 
HazardFunction 
Gets the hazard function, also known as the failure rate or
the conditional failure density function for this distribution
evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
InverseDistributionFunction 
Gets the inverse of the cumulative distribution function (icdf) for
this distribution evaluated at probability p. This function
is also known as the Quantile function.
(Overrides UnivariateContinuousDistributionInverseDistributionFunction(Double).)  
LogCumulativeHazardFunction 
Gets the log of the cumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
LogProbabilityDensityFunction 
Gets the logprobability density function (pdf) for
this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionLogProbabilityDensityFunction(Double).)  
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
Pert(Double, Double, Double) 
Constructs a BetaPERT distribution defined in the interval (a, b)
using usual PERT estimation for the parameters a, b, mode and λ.
 
Pert(Double, Double, Double, Double) 
Constructs a BetaPERT distribution defined in the interval (a, b)
using usual PERT estimation for the parameters a, b, mode and λ.
 
ProbabilityDensityFunction 
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionProbabilityDensityFunction(Double).)  
QuantileDensityFunction 
Gets the first derivative of the
inverse distribution function (icdf) for this distribution evaluated
at probability p.
(Inherited from UnivariateContinuousDistribution.)  
Random(Double, Double, Double, Double) 
Generates a random observation from a
Beta distribution with the given parameters.
 
Random(Double, Double, Double, Double, Int32) 
Generates a random vector of observations from the
Beta distribution with the given parameters.
 
Random(Double, Double, Double, Double, Int32, Double) 
Generates a random vector of observations from the
Beta distribution with the given parameters.
 
Standard 
Constructs a standard Beta distribution defined in the interval (0, 1)
based on the number of successed and trials for an experiment.
 
ToString 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(IFormatProvider) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String, IFormatProvider) 
Returns a String that represents this instance.
(Overrides DistributionBaseToString(String, IFormatProvider).)  
Vose(Double, Double, Double) 
Constructs a BetaPERT distribution defined in the interval (a, b)
using Vose's PERT estimation for the parameters a, b, mode and λ.
 
Vose(Double, Double, Double, Double) 
Constructs a BetaPERT distribution defined in the interval (a, b)
using Vose's PERT estimation for the parameters a, b, mode and λ.

Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
IsEqual  Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices. (Defined by Matrix.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by Matrix.) 
The generalized beta distribution is a family of continuous probability distributions defined on any interval (min, max) parameterized by two positive shape parameters and two real location parameters, typically denoted by α, β, a and b. The beta distribution can be suited to the statistical modeling of proportions in applications where values of proportions equal to 0 or 1 do not occur. One theoretical case where the beta distribution arises is as the distribution of the ratio formed by one random variable having a Gamma distribution divided by the sum of it and another independent random variable also having a Gamma distribution with the same scale parameter (but possibly different shape parameter).
References:
Note: Simpler examples are also available at the BetaDistribution page.
The following example shows how to create a 4parameter Beta distribution and compute some of its properties and measures.
// Create a 4parameter Beta distribution with the following parameters (α, β, a, b): var beta = new GeneralizedBetaDistribution(alpha: 1.42, beta: 1.57, min: 1, max: 4.2); double mean = beta.Mean; // 2.5197324414715716 double median = beta.Median; // 2.4997705845160225 double var = beta.Variance; // 0.19999664152943961 double mode = beta.Mode; // 2.3575757575757574 double h = beta.Entropy; // 0.050654548091478513 double cdf = beta.DistributionFunction(x: 2.27); // 0.40828630817664596 double pdf = beta.ProbabilityDensityFunction(x: 2.27); // 1.2766172921464953 double lpdf = beta.LogProbabilityDensityFunction(x: 2.27); // 0.2442138392176838 double chf = beta.CumulativeHazardFunction(x: 2.27); // 0.5247323897609667 double hf = beta.HazardFunction(x: 2.27); // 2.1574915534109484 double ccdf = beta.ComplementaryDistributionFunction(x: 2.27); // 0.59171369182335409 double icdf = beta.InverseDistributionFunction(p: cdf); // 2.27 string str = beta.ToString(); // B(x; α = 1.42, β = 1.57, min = 1, max = 4.2)
The following example shows how to create a 4parameter Beta distribution with a threepoint estimate using PERT.
// Create a Beta from a minimum, maximum and most likely value var b = GeneralizedBetaDistribution.Pert(min: 1, max: 3, mode: 2); double mean = b.Mean; // 2.5197324414715716 double median = b.Median; // 2.4997705845160225 double var = b.Variance; // 0.19999664152943961 double mode = b.Mode; // 2.3575757575757574
The following example shows how to create a 4parameter Beta distribution with a threepoint estimate using Vose's modification for PERT.
// Create a Beta from a minimum, maximum and most likely value var b = GeneralizedBetaDistribution.Vose(min: 1, max: 3, mode: 1.42); double mean = b.Mean; // 1.6133333333333333 double median = b.Median; // 1.5727889200146494 double mode = b.Mode; // 1.4471823077804513 double var = b.Variance; // 0.055555555555555546
The next example shows how to generate 1000 new samples from a Beta distribution:
// Using the distribution's parameters double[] samples = GeneralizedBetaDistribution .Random(alpha: 2, beta: 3, min: 0, max: 1, samples: 1000); // Using an existing distribution var b = new GeneralizedBetaDistribution(alpha: 1, beta: 2); double[] new_samples = b.Generate(1000);
And finally, how to estimate the parameters of a Beta distribution from a set of observations, using either the Methodofmoments or the Maximum Likelihood Estimate.
// First we will be drawing 100000 observations from a 4parameter // Beta distribution with α = 2, β = 3, min = 10 and max = 15: double[] samples = GeneralizedBetaDistribution .Random(alpha: 2, beta: 3, min: 10, max: 15, samples: 100000); // We can estimate a distribution with the known max and min var B = GeneralizedBetaDistribution.Estimate(samples, 10, 15); // We can explicitly ask for a Methodofmoments estimation var mm = GeneralizedBetaDistribution.Estimate(samples, 10, 15, new GeneralizedBetaOptions { Method = BetaEstimationMethod.Moments }); // or explicitly ask for the Maximum Likelihood estimation var mle = GeneralizedBetaDistribution.Estimate(samples, 10, 15, new GeneralizedBetaOptions { Method = BetaEstimationMethod.MaximumLikelihood });