pystra.distributions.normal.Normal#

class Normal(name, mean, stdv, input_type=None, startpoint=None)[source]#

Bases: Distribution

Normal distribution

Attributes:
  • name (str): Name of the random variable

  • mean (float): Mean

  • stdv (float): Standard deviation

  • input_type (any): Change meaning of mean and stdv

  • startpoint (float): Start point for seach

Note: while we could use SciPy norm distribution here, there is a substantial perfromance hit, so use local implementation.

Leave initialization to the base class

Methods

cdf

cumulative distribution function

dF_dtheta

Analytical derivatives of the Normal CDF w.r.t.

getMean

getName

getStartPoint

getStdv

jacobian

Compute the Jacobian (e.g. Lemaire, eq.

pdf

probability density function

plot

Plot the probability density function.

ppf

inverse cumulative distribution function

sample

Override sample from base class due to bespoke implementation

setStartPoint

set_location

Updating the distribution location parameter.

set_scale

Updating the distribution scale parameter.

u_to_x

Transformation from u to x

x_to_u

Transformation from x to u

pdf(x)[source]#

probability density function

cdf(x)[source]#

cumulative distribution function

ppf(p)[source]#

inverse cumulative distribution function

sample(n=1000)[source]#

Override sample from base class due to bespoke implementation

u_to_x(u)[source]#

Transformation from u to x

x_to_u(x)[source]#

Transformation from x to u

jacobian(u, x)[source]#

Compute the Jacobian (e.g. Lemaire, eq. 4.9) For the Normal distribution, the more usual general function can be specialized as follows.

dF_dtheta(x)[source]#

Analytical derivatives of the Normal CDF w.r.t. μ and σ.

\[ \begin{align}\begin{aligned}\frac{\partial F}{\partial \mu} = -\frac{1}{\sigma}\, \varphi\!\left(\frac{x - \mu}{\sigma}\right)\\\frac{\partial F}{\partial \sigma} = -\frac{x - \mu}{\sigma^2}\, \varphi\!\left(\frac{x - \mu}{\sigma}\right)\end{aligned}\end{align} \]
set_location(loc=0)[source]#

Updating the distribution location parameter. For Normal, there is no need to update other properties as a result of this change.

set_scale(scale=1)[source]#

Updating the distribution scale parameter. For Normal, there is no need to update other properties as a result of this change.

plot(ax=None, **kwargs)#

Plot the probability density function.

Parameters:
  • ax (matplotlib.axes.Axes, optional) – Axes to plot on. A new figure is created if None.

  • **kwargs – Additional keyword arguments forwarded to ax.plot().

Returns:

The axes containing the plot.

Return type:

matplotlib.axes.Axes

property sensitivity_params#

Distribution parameters for which sensitivities are computed.

Returns a dict {param_name: current_value} listing every parameter with respect to which \(\partial\beta/\partial\theta\) should be evaluated.

The default implementation returns {"mean": μ, "std": σ}, which is appropriate for most distributions. Distributions with additional parameters of interest (e.g. the GEV shape parameter) should override this property to include them.

Parameters listed in _ctor_kwargs but not in sensitivity_params are held fixed during sensitivity analysis — they are only used by _make_copy() to faithfully reconstruct the distribution.

Returns:

{param_name: current_value}

Return type:

dict