# Boost Math - Statistical Distributions

## Statistics

The Statistical Distributions section of the Boost Math library cover a broad range of areas

### Arcsine Distribution

    arcsine_pdf(0.5)
    #> [1] 0.6366198
    arcsine_lpdf(0.5)
    #> [1] -0.4515827
    arcsine_cdf(0.5)
    #> [1] 0.5
    arcsine_lcdf(0.5)
    #> [1] -0.6931472
    arcsine_quantile(0.5)
    #> [1] 0.5

### Bernoulli Distribution

    bernoulli_pdf(1, 0.5)
    #> [1] 0.5
    bernoulli_lpdf(1, 0.5)
    #> [1] -0.6931472
    bernoulli_cdf(1, 0.5)
    #> [1] 1
    bernoulli_lcdf(1, 0.5)
    #> [1] 0
    bernoulli_quantile(0.5, 0.5)
    #> [1] 0

### Beta Distribution

    # Beta distribution with shape parameters alpha = 2, beta = 5
    beta_pdf(0.5, 2, 5)
    #> [1] 0.9375
    beta_lpdf(0.5, 2, 5)
    #> [1] -0.06453852
    beta_cdf(0.5, 2, 5)
    #> [1] 0.890625
    beta_lcdf(0.5, 2, 5)
    #> [1] -0.1158318
    beta_quantile(0.5, 2, 5)
    #> [1] 0.26445

### Binomial Distribution

    # Binomial dist ribution with n = 10, prob = 0.5
    binomial_pdf(3, 10, 0.5)
    #> [1] 0.1171875
    binomial_lpdf(3, 10, 0.5)
    #> [1] -2.14398
    binomial_cdf(3, 10, 0.5)
    #> [1] 0.171875
    binomial_lcdf(3, 10, 0.5)
    #> [1] -1.760988
    binomial_quantile(0.5, 10, 0.5)
    #> [1] 5

### Cauchy Distribution

    # Cauchy distribution with location = 0, scale = 1
    cauchy_pdf(0)
    #> [1] 0.3183099
    cauchy_lpdf(0)
    #> [1] -1.14473
    cauchy_cdf(0)
    #> [1] 0.5
    cauchy_lcdf(0)
    #> [1] -0.6931472
    cauchy_quantile(0.5)
    #> [1] 0

### Chi-Squared Distribution

    # Chi-Squared distribution with 3 degrees of freedom
    chi_squared_pdf(2, 3)
    #> [1] 0.2075537
    chi_squared_lpdf(2, 3)
    #> [1] -1.572365
    chi_squared_cdf(2, 3)
    #> [1] 0.4275933
    chi_squared_lcdf(2, 3)
    #> [1] -0.8495828
    chi_squared_quantile(0.5, 3)
    #> [1] 2.365974

### Exponential Distribution

    # Exponential distribution with rate parameter lambda = 2
    exponential_pdf(1, 2)
    #> [1] 0.2706706
    exponential_lpdf(1, 2)
    #> [1] -1.306853
    exponential_cdf(1, 2)
    #> [1] 0.8646647
    exponential_lcdf(1, 2)
    #> [1] -0.1454135
    exponential_quantile(0.5, 2)
    #> [1] 0.3465736

### Extreme Value Distribution

    # Extreme Value distribution with location = 0, scale = 1
    extreme_value_pdf(0)
    #> [1] 0.3678794
    extreme_value_lpdf(0)
    #> [1] -1
    extreme_value_cdf(0)
    #> [1] 0.3678794
    extreme_value_lcdf(0)
    #> [1] -1
    extreme_value_quantile(0.5)
    #> [1] 0.3665129

### F Distribution

    # Fisher F distribution with df1 = 5, df2 = 2
    fisher_f_pdf(1, 5, 2)
    #> [1] 0.3080008
    fisher_f_lpdf(1, 5, 2)
    #> [1] -1.177653
    fisher_f_cdf(1, 5, 2)
    #> [1] 0.4312012
    fisher_f_lcdf(1, 5, 2)
    #> [1] -0.8411806
    fisher_f_quantile(0.5, 5, 2)
    #> [1] 1.251925

### Gamma Distribution

    # Gamma distribution with shape = 3, scale = 4
    gamma_pdf(2, 3, 4)
    #> [1] 0.01895408
    gamma_lpdf(2, 3, 4)
    #> [1] -3.965736
    gamma_cdf(2, 3, 4)
    #> [1] 0.01438768
    gamma_lcdf(2, 3, 4)
    #> [1] -4.241383
    gamma_quantile(0.5, 3, 4)
    #> [1] 10.69624

### Geometric Distribution

    # Geometric distribution with probability of success prob = 0.5
    geometric_pdf(3, 0.5)
    #> [1] 0.0625
    geometric_lpdf(3, 0.5)
    #> [1] -2.772589
    geometric_cdf(3, 0.5)
    #> [1] 0.9375
    geometric_lcdf(3, 0.5)
    #> [1] -0.06453852
    geometric_quantile(0.5, 0.5)
    #> [1] 0

### Holtsmark Distribution

    # Holtsmark distribution with location 0 and scale 1
    holtsmark_pdf(3)
    #> [1] 0.03150942
    holtsmark_lpdf(3)
    #> [1] -3.457469
    holtsmark_cdf(3)
    #> [1] 0.9484022
    holtsmark_lcdf(3)
    #> [1] -0.05297661
    holtsmark_quantile(0.5)
    #> [1] 0

### Hyperexponential Distribution

    # Hyperexponential distribution with probabilities = c(0.5, 0.5) and rates = c(1, 2)
    hyperexponential_pdf(2, c(0.5, 0.5), c(1, 2))
    #> [1] 0.08598328
    hyperexponential_lpdf(2, c(0.5, 0.5), c(1, 2))
    #> [1] -2.453602
    hyperexponential_cdf(2, c(0.5, 0.5), c(1, 2))
    #> [1] 0.9231745
    hyperexponential_lcdf(2, c(0.5, 0.5), c(1, 2))
    #> [1] -0.07993696
    hyperexponential_quantile(0.5, c(0.5, 0.5), c(1, 2))
    #> [1] 0.4812118

### Hypergeometric Distribution

    # Hypergeometric distribution with r = 5, n = 10, N = 20
    hypergeometric_pdf(3, 5, 10, 20)
    #> [1] 0.3482972
    hypergeometric_lpdf(3, 5, 10, 20)
    #> [1] -1.054699
    hypergeometric_cdf(3, 5, 10, 20)
    #> [1] 0.8482972
    hypergeometric_lcdf(3, 5, 10, 20)
    #> [1] -0.1645242
    hypergeometric_quantile(0.5, 5, 10, 20)
    #> [1] 3

### Inverse Chi-Squared Distribution

    # Inverse Chi-Squared distribution with 3 degrees of freedom, scale = 1
    inverse_chi_squared_pdf(2, 3, 1)
    #> [1] 0.1730996
    inverse_chi_squared_lpdf(2, 3, 1)
    #> [1] -1.753888
    inverse_chi_squared_cdf(2, 3, 1)
    #> [1] 0.6822703
    inverse_chi_squared_lcdf(2, 3, 1)
    #> [1] -0.3823293
    inverse_chi_squared_quantile(0.5, 3, 1)
    #> [1] 1.267977

### Inverse Gamma Distribution

    # Inverse Gamma distribution with shape = 3, scale = 4
    inverse_gamma_pdf(2, 3, 4)
    #> [1] 0.2706706
    inverse_gamma_lpdf(2, 3, 4)
    #> [1] -1.306853
    inverse_gamma_cdf(2, 3, 4)
    #> [1] 0.6766764
    inverse_gamma_lcdf(2, 3, 4)
    #> [1] -0.3905621
    inverse_gamma_quantile(0.5, 3, 4)
    #> [1] 1.495853

### Inverse Gaussian Distribution

    # Inverse Gaussian distribution with mu = 3, lambda = 4
    inverse_gaussian_pdf(2, 3, 4)
    #> [1] 0.2524295
    inverse_gaussian_lpdf(2, 3, 4)
    #> [1] -1.376623
    inverse_gaussian_cdf(2, 3, 4)
    #> [1] 0.4512408
    inverse_gaussian_lcdf(2, 3, 4)
    #> [1] -0.7957542
    inverse_gaussian_quantile(0.5, 3, 4)
    #> [1] 2.202698

### Kolmogorov-Smirnov Distribution

    # Kolmogorov-Smirnov distribution with sample size n = 10
    kolmogorov_smirnov_pdf(0.5, 10)
    #> [1] 0.2695176
    kolmogorov_smirnov_lpdf(0.5, 10)
    #> [1] -1.311122
    kolmogorov_smirnov_cdf(0.5, 10)
    #> [1] 0.9865241
    kolmogorov_smirnov_lcdf(0.5, 10)
    #> [1] -0.01356751
    kolmogorov_smirnov_quantile(0.5, 10)
    #> [1] 0.2617017

### Landau Distribution

    # Landau distribution with location 0 and scale 1
    landau_pdf(3)
    #> [1] 0.05863949
    landau_lpdf(3)
    #> [1] -2.836347
    landau_cdf(3)
    #> [1] 0.7792967
    landau_lcdf(3)
    #> [1] -0.2493635
    landau_quantile(0.5)
    #> [1] 0.5756301

### Laplace Distribution

    # Laplace distribution with location = 0, scale = 1
    laplace_pdf(0)
    #> [1] 0.5
    laplace_lpdf(0)
    #> [1] -0.6931472
    laplace_cdf(0)
    #> [1] 0.5
    laplace_lcdf(0)
    #> [1] -0.6931472
    laplace_quantile(0.5)
    #> [1] 0

### Logistic Distribution

    # Logistic distribution with location = 0, scale = 1
    logistic_pdf(0)
    #> [1] 0.25
    logistic_lpdf(0)
    #> [1] -1.386294
    logistic_cdf(0)
    #> [1] 0.5
    logistic_lcdf(0)
    #> [1] -0.6931472
    logistic_quantile(0.5)
    #> [1] 0

### Log Normal Distribution

    # Log Normal distribution with location = 0, scale = 1
    lognormal_pdf(0)
    #> [1] 0
    lognormal_lpdf(0)
    #> [1] -Inf
    lognormal_cdf(0)
    #> [1] 0
    lognormal_lcdf(0)
    #> [1] -Inf
    lognormal_quantile(0.5)
    #> [1] 1

### Map-Airy Distribution

    # Map-Airy distribution with location 0 and scale 1
    mapairy_pdf(3)
    #> [1] 0.02799732
    mapairy_lpdf(3)
    #> [1] -3.575647
    mapairy_cdf(3)
    #> [1] 0.9316961
    mapairy_lcdf(3)
    #> [1] -0.07074859
    mapairy_quantile(0.5)
    #> [1] -0.7167107

### Negative Binomial Distribution

    negative_binomial_pdf(3, 5, 0.5)
    #> [1] 0.1367188
    negative_binomial_lpdf(3, 5, 0.5)
    #> [1] -1.989829
    negative_binomial_cdf(3, 5, 0.5)
    #> [1] 0.3632812
    negative_binomial_lcdf(3, 5, 0.5)
    #> [1] -1.012578
    negative_binomial_quantile(0.5, 5, 0.5)
    #> [1] 4

### Noncentral Beta Distribution

    # Noncentral Beta distribution with shape parameters alpha = 2, beta = 3
    # and noncentrality parameter lambda = 1
    non_central_beta_pdf(0.5, 2, 3, 1)
    #> [1] 1.643543
    non_central_beta_lpdf(0.5, 2, 3, 1)
    #> [1] 0.4968546
    non_central_beta_cdf(0.5, 2, 3, 1)
    #> [1] 0.5977904
    non_central_beta_lcdf(0.5, 2, 3, 1)
    #> [1] -0.514515
    non_central_beta_quantile(0.5, 2, 3, 1)
    #> [1] 0.4416064

### Noncentral Chi-Squared Distribution

    # Noncentral Chi-Squared distribution with 3 degrees of freedom and noncentrality
    # parameter 1
    non_central_chi_squared_pdf(2, 3, 1)
    #> [1] 0.172252
    non_central_chi_squared_lpdf(2, 3, 1)
    #> [1] -1.758797
    non_central_chi_squared_cdf(2, 3, 1)
    #> [1] 0.3082525
    non_central_chi_squared_lcdf(2, 3, 1)
    #> [1] -1.176836
    non_central_chi_squared_quantile(0.5, 3, 1)
    #> [1] 3.213009

### Noncentral F Distribution

    # Noncentral F distribution with df1 = 5, df2 = 2 and noncentrality
    # parameter 1
    non_central_f_pdf(1, 5, 2, 1)
    #> [1] 0.3051418
    non_central_f_lpdf(1, 5, 2, 1)
    #> [1] -1.186979
    non_central_f_cdf(1, 5, 2, 1)
    #> [1] 0.3737987
    non_central_f_lcdf(1, 5, 2, 1)
    #> [1] -0.9840377
    non_central_f_quantile(0.5, 5, 2, 1)
    #> [1] 1.507635

### Noncentral T Distribution

    # Noncentral T distribution with 3 degrees of freedom and noncentrality parameter 1
    non_central_t_pdf(0, 3, 1)
    #> [1] 0.2229319
    non_central_t_lpdf(0, 3, 1)
    #> [1] -1.500889
    non_central_t_cdf(0, 3, 1)
    #> [1] 0.1586553
    non_central_t_lcdf(0, 3, 1)
    #> [1] -1.841022
    non_central_t_quantile(0.5, 3, 1)
    #> [1] 1.091153

### Normal Distribution

    # Normal distribution with mean = 0, sd = 1
    normal_pdf(0)
    #> [1] 0.3989423
    normal_lpdf(0)
    #> [1] -0.9189385
    normal_cdf(0)
    #> [1] 0.5
    normal_lcdf(0)
    #> [1] -0.6931472
    normal_quantile(0.5)
    #> [1] 0

### Pareto Distribution

    # Pareto distribution with shape = 1, scale = 1
    pareto_pdf(1)
    #> [1] 1
    pareto_lpdf(1)
    #> [1] 0
    pareto_cdf(1)
    #> [1] 0
    pareto_lcdf(1)
    #> [1] -Inf
    pareto_quantile(0.5)
    #> [1] 2

### Poisson Distribution

    # Poisson distribution with lambda = 1
    poisson_pdf(0, 1)
    #> [1] 0.3678794
    poisson_lpdf(0, 1)
    #> [1] -1
    poisson_cdf(0, 1)
    #> [1] 0.3678794
    poisson_lcdf(0, 1)
    #> [1] -1
    poisson_quantile(0.5, 1)
    #> [1] 1

### Rayleigh Distribution

    # Rayleigh distribution with scale = 1
    rayleigh_pdf(1)
    #> [1] 0.6065307
    rayleigh_lpdf(1)
    #> [1] -0.5
    rayleigh_cdf(1)
    #> [1] 0.3934693
    rayleigh_lcdf(1)
    #> [1] -0.9327521
    rayleigh_quantile(0.5)
    #> [1] 1.17741

### SaS Point5 Distribution

    # SaS Point5 distribution with location 0 and scale 1
    saspoint5_pdf(3)
    #> [1] 0.02379919
    saspoint5_lpdf(3)
    #> [1] -3.738104
    saspoint5_cdf(3)
    #> [1] 0.8164545
    saspoint5_lcdf(3)
    #> [1] -0.2027841
    saspoint5_quantile(0.5)
    #> [1] 0

### Skew Normal Distribution

    # Skew Normal distribution with location = 0, scale = 1, shape = 0
    skew_normal_pdf(0)
    #> [1] 0.3989423
    skew_normal_lpdf(0)
    #> [1] -0.9189385
    skew_normal_cdf(0)
    #> [1] 0.5
    skew_normal_lcdf(0)
    #> [1] -0.6931472
    skew_normal_quantile(0.5)
    #> [1] 0

### Student’s T Distribution

    # Student's t distribution with 3 degrees of freedom
    students_t_pdf(0, 3)
    #> [1] 0.3675526
    students_t_lpdf(0, 3)
    #> [1] -1.000889
    students_t_cdf(0, 3)
    #> [1] 0.5
    students_t_lcdf(0, 3)
    #> [1] -0.6931472
    students_t_quantile(0.5, 3)
    #> [1] 0

### Triangular Distribution

    # Triangular distribution with lower = 0, mode = 1, upper = 2
    triangular_pdf(1)
    #> [1] 1
    triangular_lpdf(1)
    #> [1] 0
    triangular_cdf(1)
    #> [1] 0.5
    triangular_lcdf(1)
    #> [1] -0.6931472
    triangular_quantile(0.5)
    #> [1] 1

### Uniform Distribution

    # Uniform distribution with lower = 0, upper = 1
    uniform_pdf(0.5)
    #> [1] 1
    uniform_lpdf(0.5)
    #> [1] 0
    uniform_cdf(0.5)
    #> [1] 0.5
    uniform_lcdf(0.5)
    #> [1] -0.6931472
    uniform_quantile(0.5)
    #> [1] 0.5

### Weibull Distribution

    # Weibull distribution with shape = 1, scale = 1
    weibull_pdf(1)
    #> [1] 0.3678794
    weibull_lpdf(1)
    #> [1] -1
    weibull_cdf(1)
    #> [1] 0.6321206
    weibull_lcdf(1)
    #> [1] -0.4586751
    weibull_quantile(0.5)
    #> [1] 0.6931472