Warning
This is a review version of the documentation for PyOpenSci submission.
ArcSine Distribution#
- class ArcSineDistribution(amplitude: float = 1.0, loc: float = 0.0, scale: float = 1.0, normalize: bool = False)[source]#
Bases:
BaseDistributionClass for ArcSine distribution.
Note
The
ArcSineDistributionis a special case of theBetaDistribution,\(\alpha_\text{beta} = 0.5\),
\(\lambda_\text{beta} = 0.5\).
- Parameters:
amplitude (float, optional) – The amplitude of the PDF. Defaults to 1.0. Ignored if normalize is
True.loc (float, optional) – The location parameter, \(-\) shifting. Defaults to 0.0.
scale (float, optional) – The scale parameter, for shifting. Defaults to 1.0.
normalize (bool, optional) – If
True, the distribution is normalized so that the total area under the PDF equals 1. Defaults toFalse.
- Raises:
NegativeAmplitudeError – If the provided value of amplitude is negative.
NegativeScaleError – If the provided value of scale is negative.
- Example:
Importing libraries
3import matplotlib.pyplot as plt 4import numpy as np 5from scipy.stats import arcsine 6 7from pymultifit.distributions import ArcSineDistribution
Generating the ArcSine distribution with
pyMultiFitandscipy.9x_values = np.linspace(start=0, stop=1, num=500) 10 11y_multifit = ArcSineDistribution(normalize=True) 12y_scipy = arcsine
Plotting PDF and CDF
14f, ax = plt.subplots(1, 2, figsize=(12, 5)) 15 16ax[0].plot(x_values, y_scipy.pdf(x_values), label='Scipy ArcSine') 17ax[0].plot(x_values, y_multifit.pdf(x_values), 'k:', label='pyMultiFit ArcSine') 18ax[0].set_ylabel('f(x)') 19 20ax[1].plot(x_values, y_scipy.cdf(x_values), label='Scipy ArcSine') 21ax[1].plot(x_values, y_multifit.cdf(x_values), 'k:', label='pyMultiFit ArcSine') 22ax[1].set_ylabel('F(x)') 23 24for i in ax: 25 i.set_xlabel('X') 26 i.legend() 27plt.tight_layout()
- Attributes:
Methods
cdf(x)Compute the cumulative density function (CDF) for the distribution.
from_scipy_params([loc, scale])Instantiate ArcSineDistribution with scipy parameterization.
logcdf(x)Compute the log cumulative density function (logCDF) for the distribution.
logpdf(x)Compute the log probability density function (logPDF) for the distribution.
pdf(x)Compute the probability density function (PDF) for the distribution.
scipy_like([loc, scale])Instantiate ArcSineDistribution with scipy parameterization.
stats()Computes and returns the statistical properties of the distribution, including,
- classmethod scipy_like(loc: float = 0.0, scale: float = 1.0) ArcSineDistribution[source]#
Instantiate ArcSineDistribution with scipy parameterization.
- Parameters:
- loc: float, optional
The location parameter. Defaults to 0.0.
- scale: float, optional
The scale parameter. Defaults to 1.0.
- Returns:
- ArcSineDistribution
An instance of normalized ArcSineDistribution.
Deprecated since version 1.0.7: Use from_scipy_params instead of scipy_like. scipy_like will be removed in a future release.
- classmethod from_scipy_params(loc: float = 0.0, scale: float = 1.0) ArcSineDistribution[source]#
Instantiate ArcSineDistribution with scipy parameterization.
- Parameters:
- loc: float, optional
The location parameter. Defaults to 0.0.
- scale: float, optional
The scale parameter. Defaults to 1.0.
- Returns:
- ArcSineDistribution
An instance of normalized ArcSineDistribution.
- pdf(x: ndarray) ndarray[source]#
Compute the probability density function (PDF) for the distribution.
- Parameters:
x – Input array at which to evaluate the PDF.
- logpdf(x: ndarray) ndarray[source]#
Compute the log probability density function (logPDF) for the distribution.
- Parameters:
x – Input array at which to evaluate the logPDF.
- cdf(x: ndarray) ndarray[source]#
Compute the cumulative density function (CDF) for the distribution.
- Parameters:
x – Input array at which to evaluate the CDF.
- logcdf(x: ndarray) ndarray[source]#
Compute the log cumulative density function (logCDF) for the distribution.
- Parameters:
x – Input array at which to evaluate the logCDF.
- stats() Dict[str, float][source]#
Computes and returns the statistical properties of the distribution, including,
mean,
median,
variance, and
standard deviation.
- Returns:
A dictionary containing statistical properties such as mean, variance, etc.
- Return type:
Notes
If any of the parameter is not computable for a distribution, this method returns None.
This class internally utilizes the following functions from utilities_d module:
Recommended Import#
from pymultifit.distributions import ArcSineDistribution
Full Import#
from pymultifit.distributions.arcSine_d import ArcSineDistribution