Create a PDF (Probability Density Function) object.
Use this to create a PDF object given a list or array of x values the corresponding PDF values.
Parameters: |
|
---|
Add two PDFs, returning a new one.
Divide two PDFs, returning a new PDF
Multiply two PDFs, returning a new PDF
Subtract two PDFs, returning a new PDF
Computes the Cumulative Density Function (CDF) for some values.
Parameters: | arr – Array of x values. |
---|---|
Returns: | Array of cdf(x). |
Generates a descriptive sample for this distribution.
The order of the numbers in the array is random, so it can be combined with other arrays to form a latin hypercube. This method is used by LHS.
Parameters: | num – Number of samples to generate. |
---|---|
Returns: | 1D array of length num. |
Generates a descriptive sample in [-1,1] for this distribution.
The order of the numbers in the array is random, so it can be combined with other arrays to form a latin hypercube. Note that this can return values outside the range [-1,1] for distributions with long tails. This method is used by puq.Smolyak.
Parameters: | num – Number of samples to generate. |
---|---|
Returns: | 1D array of length num. |
Latin Hypercube Sample for this distribution.
The order of the numbers in the array is random, so it can be combined with other arrays to form a latin hypercube. This method is used by LHS.
Parameters: | num – Number of samples to generate. |
---|---|
Returns: | 1D array of length num. |
Latin Hypercube Sample in [-1,1] for this distribution.
The order of the numbers in the array is random, so it can be combined with other arrays to form a latin hypercube. Note that this can return values outside the range [-1,1] for distributions with long tails. This method is used by puq.Smolyak.
Parameters: | num – Number of samples to generate. |
---|---|
Returns: | 1D array of length num. |
Find the mode of the PDF. The mode is the x value at which pdf(x) is at its maximum. It is the peak of the PDF.
Computes the Probability Density Function (PDF) for some values.
Parameters: | arr – Array of x values. |
---|---|
Returns: | Array of pdf(x). |
Plot a PDF.
Parameters: |
|
---|---|
Returns: | A list of lines that were added. |
Percent Point Function (inverse CDF)
Parameters: | arr – Array of x values. |
---|---|
Returns: | Array of ppf(x). |
Generate random numbers fitting this parameter’s distribution.
This method is used by MonteCarlo.
Parameters: | num – Number of samples to generate. |
---|---|
Returns: | 1D array of length num. |
The range for the PDF. For PDFs with long tails, it is truncated to 99.99% by default. You can customize this by setting options[‘pdf’][‘range’].
Returns: | A tuple containing the min and max. |
---|
The small range for the PDF. For PDFs with long tails, it is truncated to 99.8% by default. You can customize this by setting options[‘pdf’][‘srange’].
Returns: | A tuple containing the min and max. |
---|
Creates Exponential Probability Density Function.
Parameters: | rate – The rate parameter for the distribution. Must be > 0. |
---|---|
Returns: | A PDF object |
Creates a normal (gaussian) Probability Density Function.
Parameters: |
|
---|---|
Returns: | A PDF object |
For the normal distribution, you must specify mean and dev.
Example: |
---|
>>> n = NormalPDF(10,1)
>>> n = NormalPDF(mean=10, dev=1)
>>> n = NormalPDF(mean=10, dev=1, min=10)
Creates Rayleigh Probability Density Function.
Parameters: | scale – The scale. Must be > 0. |
---|---|
Returns: | A PDF object |
Creates a triangle Probability Density Function.
See http://en.wikipedia.org/wiki/Triangular_distribution
Parameters: |
|
---|---|
Returns: | A PDF object |
You can enter the parameters in any order. They will be sorted so that the mode is the middle value.
Creates a uniform Probability Density Function.
Parameters: |
|
---|---|
Returns: | A PDF object |
For the uniform distribution, you must specify two of (min, max, and mean). The third parameter will be calculated automatically.
Example: |
---|
>>> u = UniformPDF(10,20)
>>> u = UniformPDF(min=10, max=20)
>>> u = UniformPDF(min=10, mean=15)
Creates Weibull Probability Density Function.
Parameters: |
|
---|---|
Returns: | A PDF object |
Create an experimental PDF.
An experimental PDF is derived from the results of an experiment or measurement of some parameter. It has actual data attached to it. That data is then used to create a PDF by one of three different methods.
The PDF can built by binning the data and linearly interpolating, using a Gaussian KDE, or using Bayesian Inference.
Parameters: |
|
---|
Histogram PDF - initialized with points from a histogram.
This function creates a PDF from a histogram. This is useful when some other software has generated a PDF from your data.
Parameters: |
|
---|---|
Returns: | A PDF object. |
Retrieves a PDF from a remote address.
Parameters: | addr – URI. PDF must be stored in JSON format |
---|---|
Returns: | A PDF object |
Example: |
>>> u = NetPDF('http://foo.com/myproject/parameters/density')