Maximum likelihood estimation (MLE) of the location parameter of the Cauchy (Lorentzian) distribution.
All functionality is contained inside cauchy.py
. Example usage:
from cauchy import cauchy_sample, cauchy_mle
alpha = 2 # location parameter
beta = 1 # scale parameter
# generate random sample of size 10000 from Cauchy distribution
x = cauchy_sample(10000, alpha, beta)
# Maximum likelihood estimation of location parameter
alpha_mle = cauchy_mle(x=x, # sample
beta=beta, # known scale parameter
start=1, # initial guess (if None, we use median of x)
tol=1e-6, # tolerance for convergence
max_iter=1000) # maximum number of iterations
where
For a set of independent Cauchy random variables {
The log-likelihood function is then
The first derivative with respect to
and the second derivative is
We typically obtain the maximum likelihood estimate by setting
To sample from
Proof: Let
Then,