BRAYLFIT Parameter estimates for Beta-Rayleigh data. CALL: [phat,cov, pci] = braylfit(data,alpha); phat = [a, b, c] = maximum likelihood estimates of the parameters of the Beta-Rayleigh distribution (see braylpdf) given the data. cov = asymptotic covariance matrix of estimates pci = 100*(1-alpha) percent confidense intervals data = data matrix alpha = confidence level (default 0.05 corresponding to 95% CI) Example: a = .9; b = 105; sz = [100,1] R = sort(wbetarnd(a,b,sz)); phat = braylfit(R) empdistr(R,[R braylpdf(R,p(1),p(2),p(3))]) See also braylpdf, wbetafit
Log-likelihood function. | |
Parameter estimates for Beta data. | |
Inverse of the Normal distribution function | |
Display message and abort function. | |
Multidimensional unconstrained nonlinear minimization (Nelder-Mead). | |
Convert string matrix to numeric array. | |
MATLAB version number. |
001 function [phat, cov,pci]=braylfit(data1,alpha) 002 %BRAYLFIT Parameter estimates for Beta-Rayleigh data. 003 % 004 % CALL: [phat,cov, pci] = braylfit(data,alpha); 005 % 006 % phat = [a, b, c] = maximum likelihood estimates of the 007 % parameters of the Beta-Rayleigh distribution (see 008 % braylpdf) given the data. 009 % cov = asymptotic covariance matrix of estimates 010 % pci = 100*(1-alpha) percent confidense intervals 011 % data = data matrix 012 % alpha = confidence level (default 0.05 corresponding to 95% CI) 013 % 014 % Example: 015 % a = .9; b = 105; sz = [100,1] 016 % R = sort(wbetarnd(a,b,sz)); 017 % phat = braylfit(R) 018 % empdistr(R,[R braylpdf(R,p(1),p(2),p(3))]) 019 % 020 % See also braylpdf, wbetafit 021 022 % tested on: matlab 5.2 023 %History: 024 025 % revised pabnov 2004 026 % -replaced fmins with fminsearch 027 % by Per A. Brodtkorb 14.02.99 028 % Reference: 029 030 error(nargchk(1,2,nargin)) 031 if (nargin < 2)|isempty(alpha) 032 alpha = 0.05; 033 end 034 p_int = [alpha/2; 1-alpha/2]; 035 036 data1=data1(:) 037 038 c=sqrt(2)*max(data1); 039 pinit=[wbetafit((data1./c).^2) c] 040 041 %simultanous MLE 042 mvrs=version;ix=find(mvrs=='.'); 043 if str2num(mvrs(1:ix(2)-1))>5.2, 044 phat = fminsearch('loglike',pinit,[],data1,'braylpdf'); 045 else 046 phat = fmins('loglike',pinit,[],[],data1,'braylpdf'); 047 end 048 049 % Old call 050 %phat = fmins('brayllike',pinit,[],[],data1); 051 052 053 if nargout >1 054 [L, cov] = loglike(phat,data1,'braylpdf') 055 %[logL,cov]=brayllike(phat,data1); % old call 056 sigma = diag(cov).'; 057 pci = wnorminv(repmat(p_int,1,2),[phat; phat],[sigma;sigma]); 058 end 059 060 061
Comments or corrections to the WAFO group