File Exchange

cauchy

version 1.0 (9.38 KB) by

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

4.66667
10 Ratings

Updated

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.

hunhugh

hunhugh (view profile)

If you are struggling the Hessian error, open the paxmle.m file and add 'Algorithm','trust-region-reflective' to the options on approx line 89.

options= optimset(options, 'Hessian', 'on', 'Algorithm','trust-region-reflective');

Is it possible to get the negative log likelihood returned as well?

Antonio Calcagnì

Antonio Calcagnì (view profile)

Very useful package! Thank you

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);

Heyyo

Heyyo (view profile)

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

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.

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!

Senait Senay

zhen

Ahmed Fasih

Ahmed Fasih (view profile)

Jae Hyung Kim

zhenguo tu

pretty useful toolbox, albeit short.....

Il Park

Just what I needed. MLE parameter estimater.