Code covered by the BSD License

### Highlights from cauchy

4.625
4.6 | 9 ratings Rate this file 63 Downloads (last 30 days) File Size: 9.38 KB File ID: #11749

# cauchy

### Peder Axensten (view profile)

20 Jul 2006 (Updated )

Cauchy cdf, pdf, inverse cdf, parameter fit, and random generator.

File Information
Description

Cauchy cdf, pdf, inverse cdf, parameter fit, and random generator.

Implementation package of the Cauchy distribution.

cauchycdf: Cauchy cumulative distribution function (cdf).
cauchyfit: Parameter estimation for Cauchy data.
cauchyinv: Inverse of the Cauchy cumulative distribution function (cdf).
cauchypdf: Cauchy probability density function (pdf).
cauchyrnd: Generate random numbers from the Cauchy distribution.

If you find any errors, please let me know (peder at axensten dot se).

NOTE: I'd like to know about the math for calculating the parameters confidence interval in cauchyfit. Any help appreciated.

Should work on almost any version of Matlab.

Copyright (C) Peder Axensten <peder at axensten dot se>

HISTORY
Version 1.0, 2006-07-10.
Version 1.1, 2006-07-26.
- Added cauchyfit to the cauchy package.
Version 1.2, 2006-08-06:
- cauchyinv(0, ...) returned a large negative number but should be -Inf.
- Can now estimate one parameter when the other is given.
- Size comparison in argument check didn't work.
- Various other improvements to check list.
- The arrangement of arguments now follows the ways of Statistics Toolbox.
- Put the actual mle in a separate file.

Acknowledgements

This file inspired Particle Swarm Optimization Research Toolbox.

MATLAB release MATLAB 7.0.1 (R14SP1)
Other requirements Probably works on almost any version of Matlab.
17 Mar 2015 Ngai Li

### Ngai Li (view profile)

Hi, I try to follow the example to fit a cauchy distribution, but get the below error. Could you help?

>> x= cauchyrnd(1, 0.3, [1 100]);
>> params1= cauchyfit(x, [1 NaN], 'info2');

size mean median std
Data: 100.000000 1.097133 0.990006 1.321503
Error using fmincon (line 797)
Hessian option set to 'on' but no Hessian function provided in options HessFcn nor in HessMult.

Error in paxmle (line 98)
[mlepars,fval,exitflag,output]= fmincon(negloglike, pars, ...

Error in cauchyfit (line 116)
[mlepars, output]= paxmle(ipars, negloglikeshort, lBounds, dbgstr);

Comment only
23 May 2014 Heyyo

### Heyyo (view profile)

I have realized that the reason for this error is 2014a MATLAB, it still works for previous versions.

23 May 2014 Heyyo

### Heyyo (view profile)

Hello, I was able to use this code before but now I get the following error ``Error using fmincon (line 816), Hessian option set to 'on' but no Hessian function provided in options HessFcn nor in HessMult.`` Can you please help me out with it.

28 Mar 2014 winggy

### winggy (view profile)

I tried to use this tool to estimate 2 parameters at the same time with matlab2013a. However, I got the following errors.

Error using contourc
Input arguments for contourc must be of type 'double'.

Error in contours (line 82)
CS = contourc(varargin{numarg_for_call});

Error in contour3 (line 116)
[c, msg] = contours(args{1 : nin});

Error in paxmle (line 158)
contour3(aa, bb, LL, 'LineSpec', 'k');

Error in cauchyfit (line 116)
[mlepars, output]= paxmle(ipars, negloglikeshort, lBounds, dbgstr);

How can I deal with these errors? Could you please give me some advice? Thank you!

03 Jan 2014 Senait Senay

21 Nov 2012 zhen

### zhen (view profile)

13 Jul 2010 Ahmed Fasih

### Ahmed Fasih (view profile)

18 Oct 2008 Jae Hyung Kim
15 Apr 2007 zhenguo tu

pretty useful toolbox, albeit short.....

26 Mar 2007 Il Park

Just what I needed. MLE parameter estimater.