File Exchange

image thumbnail

cauchy

version 1.0 (9.38 KB) by

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

4.66667
10 Ratings

42 Downloads

Updated

View License

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.

Comments and Ratings (12)

hunhugh

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?

Very useful package! Thank you

Ngai Li

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

zhen (view profile)

Ahmed Fasih

Jae Hyung Kim

zhenguo tu

pretty useful toolbox, albeit short.....

Il Park

Just what I needed. MLE parameter estimater.

Updates

- Added cauchyfit to the cauchy package.

MATLAB Release
MATLAB 7.0.1 (R14SP1)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video