pystra.distributions.normal.Normal#
- class Normal(name, mean, stdv, input_type=None, startpoint=None)[source]#
Bases:
DistributionNormal 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
cumulative distribution function
Analytical derivatives of the Normal CDF w.r.t.
getMeangetNamegetStartPointgetStdvCompute the Jacobian (e.g. Lemaire, eq.
probability density function
Plot the probability density function.
inverse cumulative distribution function
Override sample from base class due to bespoke implementation
setStartPointUpdating the distribution location parameter.
Updating the distribution scale parameter.
Transformation from u to x
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_kwargsbut not insensitivity_paramsare 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