Class GenericDistribution

java.lang.Object
jdistlib.generic.GenericDistribution
Direct Known Subclasses:
Ansari, Arcsine, AsymmetricLaplace, Beta, BetaBinomial, BetaNegativeBinomial, BetaPrime, Binomial, BirnbaumSaunders, Categorical, Cauchy, CensoredDistribution, CertifiedInfiniteDiscreteDistribution, CgmyDistribution, Chi, ChiSquare, ConditionalDistribution, DelaporteDistribution, DiscreteLaplace, DiscreteWeibull, Empirical, EmpiricalDistribution, Exponential, ExponentiallyModifiedGaussian, Extreme, F, FellerPareto, FiniteGridDistribution, FoldedNormal, Fretchet, Gamma, GeneralizedBetaSecondKind, GeneralizedF, GeneralizedGamma, GeneralizedHyperbolicDistribution, GeneralizedInverseGaussianDistribution, GeneralizedPareto, Geometric, GEV, Gompertz, Gumbel, HalfCauchy, HalfNormal, HalfT, Huber, HurdleNegativeBinomial, HurdlePoisson, HyperGeometric, InvGamma, InvNormal, Kendall, Kumaraswamy, Laplace, Levy, LevyIncrementDistribution, Lindley, Logarithmic, Logistic, LogitNormal, LogLogistic, LogNormal, Makeham, Maxwell, MaxwellBoltzmann, MeixnerDistribution, MixtureDistribution, MonotoneTransformDistribution, Nakagami, NegativeHypergeometric, NegBinomial, NonCentralBeta, NonCentralChiSquare, NonCentralF, NonCentralT, Normal, NormalTemperedStableDistribution, NumericalContinuousDistribution, NumericalDiscreteDistribution, NumericalPiecewiseDistribution, OptionImpliedDistribution, Order, OrderStatisticDistribution, PhaseType, Poisson, PoissonBinomial, PoissonInverseGaussian, PolyaAeppliDistribution, PositiveNormal, PositiveTemperedStableDistribution, Rayleigh, ReverseWeibull, Rice, SignRank, SinhArcsinh, Skellam, SkewedT, Slash, Spearman, StableDistribution, T, Triangular, TruncatedContinuousDistribution, Tukey, TukeyLambda, Tweedie, Uniform, VarianceGammaDistribution, Weibull, Wilcoxon, ZeroInflatedNegativeBinomial, ZeroInflatedPoisson, ZeroTruncatedNegativeBinomial, ZeroTruncatedPoisson, Zipf

public abstract class GenericDistribution extends Object
An interface for a generic distribution. All parameters have to be encoded (either as fields or otherwise). Treat this interface as an adapter to the other distributions.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected RandomEngine
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static boolean
    copyBackward(double[] input, int inputOffset, double[] output, int outputOffset, int length)
    Whether an in-place, right-shifted operation must run from right to left.
    double
    cumulative(double p)
    Assume lower tail and non-log
    double[]
    cumulative(double[] p)
    Assume lower tail and non-log
    double[]
    cumulative(double[] p, boolean lower_tail, boolean log_p)
     
    abstract double
    cumulative(double p, boolean lower_tail, boolean log_p)
     
    double
    Cumulative hazard function, which is basically -ln(1-CDF).
    double[]
    cumulative_hazard(double[] p)
     
    void
    cumulativeInto(double[] input, int inputOffset, double[] output, int outputOffset, int length, boolean lowerTail, boolean logP)
    Evaluates CDF values into caller-owned storage.
    double[]
    density(double[] x)
    Assume non-log
    double[]
    density(double[] x, boolean log)
     
    abstract double
    density(double x, boolean log)
     
    void
    densityInto(double[] input, int inputOffset, double[] output, int outputOffset, int length, boolean log)
    Evaluates densities into caller-owned storage after one range validation.
     
    double[]
    hazard(double[] t, boolean give_log)
     
    double
    hazard(double t, boolean give_log)
    Hazard function of a distribution.
    double[]
    inverse_survival(double[] p, boolean log_p)
     
    double
    inverse_survival(double p, boolean log_p)
    Inverse survival function, which is basically quantile(1-p).
    double
    quantile(double q)
    Assume lower tail and non-log
    double[]
    quantile(double[] q)
    Assume lower tail and non-log
    double[]
    quantile(double[] q, boolean lower_tail, boolean log_p)
     
    abstract double
    quantile(double q, boolean lower_tail, boolean log_p)
     
    void
    quantileInto(double[] input, int inputOffset, double[] output, int outputOffset, int length, boolean lowerTail, boolean logP)
    Evaluates quantiles into caller-owned storage.
    abstract double
     
    double[]
    random(int n)
     
    double
    Deprecated. 
    void
    randomInto(double[] output, int offset, int length)
    Generates directly into caller-owned storage.
    void
     
    double[]
    survival(double[] p)
    Survival function, which is basically 1-CDF.
    double[]
    survival(double[] p, boolean log_p)
     
    double
    survival(double p, boolean log_p)
    Survival function, which is basically 1-CDF.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • GenericDistribution

      public GenericDistribution()
  • Method Details

    • density

      public abstract double density(double x, boolean log)
    • cumulative

      public abstract double cumulative(double p, boolean lower_tail, boolean log_p)
    • quantile

      public abstract double quantile(double q, boolean lower_tail, boolean log_p)
    • random

      public abstract double random()
    • density

      public double[] density(double[] x, boolean log)
    • densityInto

      public void densityInto(double[] input, int inputOffset, double[] output, int outputOffset, int length, boolean log)
      Evaluates densities into caller-owned storage after one range validation.
    • density

      public double[] density(double[] x)
      Assume non-log
      Parameters:
      x -
      Returns:
      density
    • cumulative

      public double cumulative(double p)
      Assume lower tail and non-log
      Parameters:
      p -
      Returns:
      cdf
    • cumulative

      public double[] cumulative(double[] p, boolean lower_tail, boolean log_p)
    • cumulativeInto

      public void cumulativeInto(double[] input, int inputOffset, double[] output, int outputOffset, int length, boolean lowerTail, boolean logP)
      Evaluates CDF values into caller-owned storage.
    • cumulative

      public double[] cumulative(double[] p)
      Assume lower tail and non-log
      Parameters:
      p -
      Returns:
      cdf
    • quantile

      public double[] quantile(double[] q, boolean lower_tail, boolean log_p)
    • quantileInto

      public void quantileInto(double[] input, int inputOffset, double[] output, int outputOffset, int length, boolean lowerTail, boolean logP)
      Evaluates quantiles into caller-owned storage.
    • quantile

      public double[] quantile(double[] q)
      Assume lower tail and non-log
      Parameters:
      q -
      Returns:
      quantile
    • quantile

      public double quantile(double q)
      Assume lower tail and non-log
      Parameters:
      q -
      Returns:
      quantile
    • random

      public double[] random(int n)
    • randomInto

      public void randomInto(double[] output, int offset, int length)
      Generates directly into caller-owned storage.
    • hazard

      public double hazard(double t, boolean give_log)
      Hazard function of a distribution. Defined as: pdf / (1-cdf)
      Parameters:
      t -
      give_log -
      Returns:
      hazard value
    • hazard

      public double[] hazard(double[] t, boolean give_log)
    • cumulative_hazard

      public double cumulative_hazard(double p)
      Cumulative hazard function, which is basically -ln(1-CDF).
      Parameters:
      p -
      Returns:
      survival function
    • cumulative_hazard

      public double[] cumulative_hazard(double[] p)
    • survival

      public double survival(double p, boolean log_p)
      Survival function, which is basically 1-CDF.
      Parameters:
      p -
      Returns:
      survival function
    • survival

      public double[] survival(double[] p, boolean log_p)
    • survival

      public double[] survival(double[] p)
      Survival function, which is basically 1-CDF. Assume non-log.
      Parameters:
      p -
      Returns:
      survival function
    • inverse_survival

      public double inverse_survival(double p, boolean log_p)
      Inverse survival function, which is basically quantile(1-p).
      Parameters:
      p -
      log_p - true if the p-value is in log scale
      Returns:
      Inverse survival function
    • inverse_survival

      public double[] inverse_survival(double[] p, boolean log_p)
    • setRandomEngine

      public void setRandomEngine(RandomEngine r)
    • getRandomEngine

      public RandomEngine getRandomEngine()
    • random

      @Deprecated public double random(RandomEngine r)
      Deprecated.
      Old RNG API
      Parameters:
      r - random number generator
      Returns:
      Random number for the distribution
    • copyBackward

      protected static boolean copyBackward(double[] input, int inputOffset, double[] output, int outputOffset, int length)
      Whether an in-place, right-shifted operation must run from right to left.