Home > wafo > wavemodels > ochi98fit.m

# ochi98fit

## PURPOSE

Parameter estimates and confidence intervals for Ochi data.

## SYNOPSIS

[phat, pci,pinit]=ochi98fit(data,alpha)

## DESCRIPTION

``` OCHI98FIT Parameter estimates and confidence intervals for Ochi data.

CALL: [phat pci] = ochi98fit(data,alpha)

phat  = [a b] = maximum likelihood estimates of the parameters of the distribution
pci   = 100(1-alpha) percent confidense intervals
data  = data matrix
alpha = confidence level (default 0.05 corresponding to 95% CI)

## CROSS-REFERENCE INFORMATION

This function calls:
 loglike Log-likelihood function. wnorminv Inverse of the Normal distribution function wraylfit Parameter estimates for Rayleigh data. fmins fminsearch Multidimensional unconstrained nonlinear minimization (Nelder-Mead). info Information about MATLAB and The MathWorks. str2num Convert string matrix to numeric array. version MATLAB version number.
This function is called by:

## SOURCE CODE

```001 function [phat, pci,pinit]=ochi98fit(data,alpha)
002 %OCHI98FIT Parameter estimates and confidence intervals for Ochi data.
003 %
004 % CALL: [phat pci] = ochi98fit(data,alpha)
005 %
006 %   phat  = [a b] = maximum likelihood estimates of the parameters of the distribution
007 %   pci   = 100(1-alpha) percent confidense intervals
008 %   data  = data matrix
009 %   alpha = confidence level (default 0.05 corresponding to 95% CI)
010 %
011 %
013
014 %  Reference:
015 %       [1]  Michel K. Ochi,
016 %       "Probability distributions of peaks and troughs of non-gaussian processes"
017 %        Probabilistic Engineering Mechanics Vol 13 No 4 (1998)
018 %       pp  291-298
019
020 % tested on:
021 % history:
022 % revised pab nov 2004
023 % - replaced call to fmins with fminsearch
024 % revised pab 04.11.2000
025 % - removed ochi98like with a call to loglike instead
026 % revised pab 29.02.2000
027 %  changed name to ochi98fit
028 %  Per A. Brodtkorb 14.02.99
029
030 if (nargin < 2)|isempty(alpha)
031     alpha = 0.05;
032 end
033 p_int = [alpha/2; 1-alpha/2];
034
035 data1=data(:)
036
037 a = wraylfit(data1)*sqrt(2);
038 pinit=[a a];
039
040 %simultanous MLE
041 mvrs=version;ix=find(mvrs=='.');
042 if str2num(mvrs(1:ix(2)-1))>5.2,
043   phat = fminsearch('loglike',pinit,[],data1,'ochi98pdf');
044 else
045   phat = fmins('loglike',pinit,[],[],data1,'ochi98pdf');
046 end
047
048 if nargout == 2
049    [LL,cov]=loglike(phat,data1,'ochi98pdf');
050    sa = diag(info).';
051    pci = wnorminv(repmat(p_int,1,2),[phat; phat],[sa;sa]);
052  end
053
054```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003