Module_Statistics_Distribution - vorcyc/Vorcyc.Mathematics GitHub Wiki
Location: Home / Statistics module / Distribution
Statistics module
Distribution
Vorcyc.Mathematics.Statistics.Distribution is a class that provides methods for computing various probability distributions, including normal, Poisson, exponential, binomial, multinomial, Gamma, and Beta distributions.
All methods below are located in class: Vorcyc.Mathematics.Statistics.Distribution
:ledger:Contents
- :bookmark: NormalPDF method
- :bookmark: NormalCDF method
- :bookmark: PoissonPMF method
- :bookmark: PoissonCDF method
- :bookmark: ExponentialPDF method
- :bookmark: ExponentialCDF method
- :bookmark: BinomialPMF method
- :bookmark: BinomialCDF method
- :bookmark: MultinomialPMF method
- :bookmark: GammaPDF method
- :bookmark: GammaCDF method
- :bookmark: BetaPDF method
- :bookmark: BetaCDF method
Vorcyc.Mathematics.Statistics.Distribution class
Vorcyc.Mathematics.Statistics.Distribution is a class that provides methods for computing various probability distributions, including normal, Poisson, exponential, binomial, multinomial, Gamma, and Beta distributions.
Methods
1. NormalPDF method
public static T NormalPDF<T>(T x, T mean, T stdDev) where T : IFloatingPointIeee754<T>- Computes the probability density function of the normal distribution.
- Parameters:
x: The variable value.mean: The mean.stdDev: The standard deviation.
- Returns: The probability density value of the normal distribution.
2. NormalCDF method
public static T NormalCDF<T>(T x, T mean, T stdDev) where T : IFloatingPointIeee754<T>- Computes the cumulative distribution function of the normal distribution.
- Parameters:
x: The variable value.mean: The mean.stdDev: The standard deviation.
- Returns: The cumulative distribution value of the normal distribution.
3. PoissonPMF method
public static T PoissonPMF<T>(int k, T lambda) where T : IFloatingPointIeee754<T>- Computes the probability mass function of the Poisson distribution.
- Parameters:
k: The number of event occurrences.lambda: The average rate of events per unit time.
- Returns: The probability mass value of the Poisson distribution.
4. PoissonCDF method
public static T PoissonCDF<T>(int k, T lambda) where T : IFloatingPointIeee754<T>- Computes the cumulative distribution function of the Poisson distribution.
- Parameters:
k: The number of event occurrences.lambda: The average rate of events per unit time.
- Returns: The cumulative distribution value of the Poisson distribution.
5. ExponentialPDF method
public static T ExponentialPDF<T>(T x, T lambda) where T : IFloatingPointIeee754<T>- Computes the probability density function of the exponential distribution.
- Parameters:
x: The variable value.lambda: The distribution parameter.
- Returns: The probability density value of the exponential distribution.
6. ExponentialCDF method
public static T ExponentialCDF<T>(T x, T lambda) where T : IFloatingPointIeee754<T>- Computes the cumulative distribution function of the exponential distribution.
- Parameters:
x: The variable value.lambda: The distribution parameter.
- Returns: The cumulative distribution value of the exponential distribution.
7. BinomialPMF method
public static T BinomialPMF<T>(int k, int n, T p) where T : IFloatingPointIeee754<T>- Computes the probability mass function of the binomial distribution.
- Parameters:
k: The number of successes.n: The total number of trials.p: The probability of success on each trial.
- Returns: The probability mass value of the binomial distribution.
8. BinomialCDF method
public static T BinomialCDF<T>(int k, int n, T p) where T : IFloatingPointIeee754<T>- Computes the cumulative distribution function of the binomial distribution.
- Parameters:
k: The number of successes.n: The total number of trials.p: The probability of success on each trial.
- Returns: The cumulative distribution value of the binomial distribution.
9. MultinomialPMF method
public static T MultinomialPMF<T>(int[] counts, T[] probabilities) where T : IFloatingPointIeee754<T>- Computes the probability mass function of the multinomial distribution.
- Parameters:
counts: The count for each category.probabilities: The probability for each category.
- Returns: The probability mass value of the multinomial distribution.
10. GammaPDF method
public static T GammaPDF<T>(T x, T shape, T scale) where T : IFloatingPointIeee754<T>- Computes the probability density function of the Gamma distribution.
- Parameters:
x: The variable value.shape: The shape parameter.scale: The scale parameter.
- Returns: The probability density value of the Gamma distribution.
11. GammaCDF method
public static T GammaCDF<T>(T x, T shape, T scale) where T : IFloatingPointIeee754<T>- Computes the cumulative distribution function of the Gamma distribution.
- Parameters:
x: The variable value.shape: The shape parameter.scale: The scale parameter.
- Returns: The cumulative distribution value of the Gamma distribution.
12. BetaPDF method
public static T BetaPDF<T>(T x, T alpha, T beta) where T : IFloatingPointIeee754<T>- Computes the probability density function of the Beta distribution.
- Parameters:
x: The variable value.alpha: Shape parameter α.beta: Shape parameter β.
- Returns: The probability density value of the Beta distribution.
13. BetaCDF method
public static T BetaCDF<T>(T x, T alpha, T beta) where T : IFloatingPointIeee754<T>- Computes the cumulative distribution function of the Beta distribution.
- Parameters:
x: The variable value.alpha: Shape parameter α.beta: Shape parameter β.
- Returns: The cumulative distribution value of the Beta distribution.
Code example
The following example uses several methods from the Distribution class, with comments in the sample:
using System;
using Vorcyc.Mathematics.Statistics;
public class DistributionExample
{
public static void Main()
{
// Normal distribution example
double normalPDF = Distribution.NormalPDF(1.0, 0.0, 1.0);
double normalCDF = Distribution.NormalCDF(1.0, 0.0, 1.0);
Console.WriteLine($"Normal PDF: {normalPDF}, Normal CDF: {normalCDF}");
// Poisson distribution example
double poissonPMF = Distribution.PoissonPMF(3, 2.0);
double poissonCDF = Distribution.PoissonCDF(3, 2.0);
Console.WriteLine($"Poisson PMF: {poissonPMF}, Poisson CDF: {poissonCDF}");
// Exponential distribution example
double exponentialPDF = Distribution.ExponentialPDF(1.0, 1.0);
double exponentialCDF = Distribution.ExponentialCDF(1.0, 1.0);
Console.WriteLine($"Exponential PDF: {exponentialPDF}, Exponential CDF: {exponentialCDF}");
// Binomial distribution example
double binomialPMF = Distribution.BinomialPMF(2, 5, 0.5);
double binomialCDF = Distribution.BinomialCDF(2, 5, 0.5);
Console.WriteLine($"Binomial PMF: {binomialPMF}, Binomial CDF: {binomialCDF}");
// Multinomial distribution example
int[] counts = { 2, 3, 1 };
double[] probabilities = { 0.2, 0.5, 0.3 };
double multinomialPMF = Distribution.MultinomialPMF(counts, probabilities);
Console.WriteLine($"Multinomial PMF: {multinomialPMF}");
// Gamma distribution example
double gammaPDF = Distribution.GammaPDF(2.0, 2.0, 2.0);
double gammaCDF = Distribution.GammaCDF(2.0, 2.0, 2.0);
Console.WriteLine($"Gamma PDF: {gammaPDF}, Gamma CDF: {gammaCDF}");
// Beta distribution example
double betaPDF = Distribution.BetaPDF(0.5, 2.0, 2.0);
double betaCDF = Distribution.BetaCDF(0.5, 2.0, 2.0);
Console.WriteLine($"Beta PDF: {betaPDF}, Beta CDF: {betaCDF}");
}
}