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.
(Inherited from UnivariateContinuousDistribution.)  
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.
(Inherited from UnivariateContinuousDistribution.)  
Generate(Random) 
Generates a random observation from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate(Random).)  
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.
(Inherited from UnivariateContinuousDistribution.)  
Generate(Int32, Random) 
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Generate(Int32, Double, Random) 
Generates a random vector of observations from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate(Int32, Double, Random).)  
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.)  
InnerComplementaryDistributionFunction 
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.)  
InnerDistributionFunction 
Gets the cumulative distribution function (cdf) for
this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerDistributionFunction(Double).)  
InnerInverseDistributionFunction 
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 UnivariateContinuousDistributionInnerInverseDistributionFunction(Double).)  
InnerLogProbabilityDensityFunction 
Gets the logprobability density function (pdf) for
this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerLogProbabilityDensityFunction(Double).)  
InnerProbabilityDensityFunction 
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerProbabilityDensityFunction(Double).)  
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.
(Inherited from UnivariateContinuousDistribution.)  
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.
(Inherited from UnivariateContinuousDistribution.)  
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.
(Inherited from UnivariateContinuousDistribution.)  
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, Random) 
Generates a random observation from a
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.
 
Random(Double, Double, Double, Double, Int32, Random) 
Generates a random vector of observations from the
Beta distribution with the given parameters.
 
Random(Double, Double, Double, Double, Int32, Double, Random) 
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.)  
To(Type)  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 ExtensionMethods.) 
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 simpler 2parameter Beta distribution and compute some of its properties and measures.
double alpha = 0.42; double beta = 1.57; var betaDistribution = new GeneralizedBetaDistribution(alpha, beta); double mean = betaDistribution.Mean; // 0.21105527638190955 double median = betaDistribution.Median; // 0.11577706212908731 double var = betaDistribution.Variance; // 0.055689279830523512 double mode = betaDistribution.Mode; // 57.999999999999957 double chf = betaDistribution.CumulativeHazardFunction(x: 0.27); // 1.1828193992944409 double cdf = betaDistribution.DistributionFunction(x: 0.27); // 0.69358638272337991 double pdf = betaDistribution.ProbabilityDensityFunction(x: 0.27); // 0.94644031936694828 double lpdf = betaDistribution.LogProbabilityDensityFunction(x: 0.27); // 0.055047364344046057 double hf = betaDistribution.HazardFunction(x: 0.27); // 3.0887671630877072 double ccdf = betaDistribution.ComplementaryDistributionFunction(x: 0.27); // 0.30641361727662009 double icdf = betaDistribution.InverseDistributionFunction(p: cdf); // 0.26999999068687469 string str = betaDistribution.ToString(System.Globalization.CultureInfo.InvariantCulture); // "B(x; α = 0.42, β = 1.57)
The following example shows how to create a 4parameter (Generalized) Beta distribution and compute some of its properties and measures.
double alpha = 0.42; double beta = 1.57; var betaDistribution = new GeneralizedBetaDistribution(alpha, beta); double mean = betaDistribution.Mean; // 0.21105527638190955 double median = betaDistribution.Median; // 0.11577706212908731 double var = betaDistribution.Variance; // 0.055689279830523512 double mode = betaDistribution.Mode; // 57.999999999999957 double chf = betaDistribution.CumulativeHazardFunction(x: 0.27); // 1.1828193992944409 double cdf = betaDistribution.DistributionFunction(x: 0.27); // 0.69358638272337991 double pdf = betaDistribution.ProbabilityDensityFunction(x: 0.27); // 0.94644031936694828 double lpdf = betaDistribution.LogProbabilityDensityFunction(x: 0.27); // 0.055047364344046057 double hf = betaDistribution.HazardFunction(x: 0.27); // 3.0887671630877072 double ccdf = betaDistribution.ComplementaryDistributionFunction(x: 0.27); // 0.30641361727662009 double icdf = betaDistribution.InverseDistributionFunction(p: cdf); // 0.26999999068687469 string str = betaDistribution.ToString(System.Globalization.CultureInfo.InvariantCulture); // "B(x; α = 0.42, β = 1.57)
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 double median = b.Median; // 2 double mode = b.Mode; // 2 double var = b.Variance; // 0.071428571428571425
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 });