Skip to content

Commit e8b41fa

Browse files
authored
MAINT: stats.ContinuousDistribution.llf: remove method (scipy#22149)
1 parent af521da commit e8b41fa

File tree

1 file changed

+0
-79
lines changed

1 file changed

+0
-79
lines changed

scipy/stats/_distribution_infrastructure.py

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,85 +3416,6 @@ def plot(self, x='x', y='pdf', *, t=('cdf', 0.0005, 0.9995), ax=None):
34163416
# quantities should make us question that choice. It can still accomodate
34173417
# these methods reasonably efficiently.
34183418

3419-
def llf(self, sample, /, *, axis=-1):
3420-
r"""Log-likelihood function
3421-
3422-
Given a sample :math:`x`, the log-likelihood function (LLF) is the logarithm
3423-
of the joint probability density of the observed data. It is typically
3424-
viewed as a function of the parameters :math:`\theta` of a statistical
3425-
distribution:
3426-
3427-
.. math::
3428-
3429-
\mathcal{L}(\theta | x) = \log \left( \prod_i f_\theta(x_i) \right) = \sum_{i} \log(f_\theta(x_i))
3430-
3431-
where :math:`f_\theta` is the probability density function with
3432-
parameters :math:`\theta`.
3433-
3434-
As a method of `ContinuousDistribution`, the parameter values are specified
3435-
during instantiation; `llf` accepts only the sample :math:`x` as `sample`.
3436-
3437-
Parameters
3438-
----------
3439-
sample : array_like
3440-
The given sample for which to calculate the LLF.
3441-
axis : int or tuple of ints
3442-
The axis over which the reducing operation (sum of logarithms) is performed.
3443-
3444-
Notes
3445-
-----
3446-
The LLF is often viewed as a function of the parameters with the sample fixed;
3447-
see the Notes for an example of a function with this signature.
3448-
3449-
References
3450-
----------
3451-
.. [1] Likelihood function, *Wikipedia*,
3452-
https://en.wikipedia.org/wiki/Likelihood_function
3453-
3454-
Examples
3455-
--------
3456-
Instantiate a distribution with the desired parameters:
3457-
3458-
>>> import numpy as np
3459-
>>> import matplotlib.pyplot as plt
3460-
>>> from scipy import stats
3461-
>>> X = stats.Normal(mu=0., sigma=1.)
3462-
3463-
Evaluate the LLF with the given sample:
3464-
3465-
>>> sample = [1., 2., 3.]
3466-
>>> X.llf(sample)
3467-
-9.756815599614018
3468-
>>> np.allclose(X.llf(sample), np.sum(X.logpdf(sample)))
3469-
True
3470-
3471-
To generate a function that accepts only the parameters and
3472-
holds the data fixed:
3473-
3474-
>>> def llf(mu, sigma):
3475-
... return stats.Normal(mu=mu, sigma=sigma).llf(sample)
3476-
>>> llf(0., 1.)
3477-
-9.756815599614018
3478-
3479-
""" # noqa: E501
3480-
return np.sum(self.logpdf(sample), axis=axis)
3481-
3482-
# def dllf(self, parameters=None, *, sample, var):
3483-
# """Partial derivative of the log likelihood function."""
3484-
# parameters = parameters or {}
3485-
# self._update_parameters(**parameters)
3486-
#
3487-
# def f(x):
3488-
# update = {}
3489-
# update[var] = x
3490-
# self._update_parameters(**update)
3491-
# res = self.llf(sample=sample[:, np.newaxis], axis=0)
3492-
# return np.reshape(res, x.shape)
3493-
#
3494-
# return _differentiate(f, self._parameters[var]).df
3495-
#
3496-
# fit method removed for initial PR
3497-
34983419

34993420
# Special case the names of some new-style distributions in `make_distribution`
35003421
_distribution_names = {

0 commit comments

Comments
 (0)