Skip to content

Distributions

Nautilus.Distributions provides functions for 12 probability distribution families.

DistributionPDFCDFInverse CDFSample
Normalnormal_pdfnormal_cdfnormal_inv_cdfnormal_sample
LogNormallognormal_pdflognormal_cdflognormal_inv_cdflognormal_sample
Uniformuniform_pdfuniform_cdfuniform_inv_cdfuniform_sample
Exponentialexponential_pdfexponential_cdfexponential_inv_cdfexponential_sample
Gammagamma_pdfgamma_cdfgamma_inv_cdfgamma_sample
Chi-squaredchi_squared_pdfchi_squared_cdfchi_squared_inv_cdfchi_squared_sample
Student-tstudent_t_pdfstudent_t_cdfstudent_t_sample
Poissonpoisson_pmfpoisson_cdf
Binomialbinomial_pmfbinomial_cdf
Betabeta_pdfbeta_cdf
Ff_pdff_cdf
Weibullweibull_pdfweibull_cdfweibull_inv_cdf
  • Normal: (x, mean, std), even for the standard normal
  • Gamma: (x, shape, scale), SciPy's convention, not (x, shape, rate)
  • Exponential: (x, rate), unlike SciPy's scale = 1/rate
  • Chi-squared: (x, df) where df is degrees of freedom
  • Student-t: (x, df)
  • Poisson: (k, lambda) where k is the count
  • Binomial: (k, n, p) where n is trials and p is probability
  • Beta: (x, a, b) where a, b are shape parameters
  • F: (x, d1, d2)
  • Weibull: (x, shape, scale)

The seven _sample functions take a key as their first argument:

def normal_sample[n](k: key, template: tensor[n, f32], mean: f32, std: f32) -> tensor[n, f32]

The template tensor determines the output shape. The actual values in the template are ignored; only its shape is used. See Sampling with explicit keys for key derivation, methods, and the gamma, chi-squared, and Student-t sampling limits.

import Nautilus.Distributions (normal_pdf, normal_cdf, normal_inv_cdf)
import Nautilus.Distributions (gamma_cdf, student_t_cdf, chi_squared_cdf)
import Nautilus.Distributions (poisson_cdf, binomial_cdf, beta_cdf)

normal_cdf and normal_inv_cdf appear in Black-Scholes pricing, value-at-risk computation, and hypothesis testing. gamma_cdf and student_t_cdf underpin chi-squared and t-test p-values through the Nautilus.Testing module.