Home > wafo > wstats > wweibfit.m

wweibfit

PURPOSE ^

Parameter estimates for Weibull data.

SYNOPSIS ^

[phat, cov, pci]=wweibfit(data1, plotflag);

DESCRIPTION ^

 WWEIBFIT Parameter estimates for Weibull data. 
  
  CALL:  [phat, cov] = wweibfit(data, plotflag) 
  
      phat = [a,c] = the maximum likelihood estimates of the   
             parameters of the Weibull distribution 
             (see wweibcdf) given the data. 
      cov  = asymptotic covariance matrix of estimates 
      data = data vector 
  plotflag = 0, do not plot 
           > 0, plot the empiricial distribution function and the 
                estimated cdf (see empdistr for options)(default) 
   
  Example: 
    R=wweibrnd(10,2,1,100); 
    [phat, cov] = wweibfit(R) 
  
  See also  wweibcdf

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function [phat, cov, pci]=wweibfit(data1, plotflag); 
002 %WWEIBFIT Parameter estimates for Weibull data. 
003 % 
004 % CALL:  [phat, cov] = wweibfit(data, plotflag) 
005 % 
006 %     phat = [a,c] = the maximum likelihood estimates of the   
007 %            parameters of the Weibull distribution 
008 %            (see wweibcdf) given the data. 
009 %     cov  = asymptotic covariance matrix of estimates 
010 %     data = data vector 
011 % plotflag = 0, do not plot 
012 %          > 0, plot the empiricial distribution function and the 
013 %               estimated cdf (see empdistr for options)(default) 
014 %  
015 % Example: 
016 %   R=wweibrnd(10,2,1,100); 
017 %   [phat, cov] = wweibfit(R) 
018 % 
019 % See also  wweibcdf 
020  
021 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability 
022 % and Life Span Models", p. 25 ff, Marcel Dekker. 
023  
024 %Tested on: matlab  5.3 
025 % History: 
026 % revised pab 03.11.2000 
027 % - added 
028 % revised pab 24.10.2000 
029 %  - added nargchk + safer call to fzero 
030 %  - made sure data is a vector  
031 % rewritten ms 20.06.2000 
032  
033 error(nargchk(1,2,nargin)) 
034 if nargin<2|isempty(plotflag),  plotflag=1; end 
035  
036 data  = data1(:);                            % make sure it is a vector 
037 start = 1./(6^(1/2)/pi*std(log(data))); 
038  
039 mvrs=version;ix=find(mvrs=='.'); 
040 if str2num(mvrs(1:ix(2)-1))>5.2, 
041   chat = fzero('wweibcfit',start,optimset,data);  
042 else 
043   chat = fzero('wweibcfit',start,sqrt(eps),[],data); 
044 end 
045 ahat = mean(data.^chat).^(1./chat); 
046 phat = [ahat(:), chat(:)]; 
047  
048 cov=[1.109*ahat^2/chat^2,0.257*ahat;0.257*ahat,0.608*chat^2]/length(data); 
049  
050 if nargout>2, 
051   var=diag(cov)'; 
052   alpha2=ones(1,2)*0.05/2; 
053   pci = wnorminv([alpha2;1-alpha2],[phat;phat],[var;var]); 
054 end 
055  
056  
057 if plotflag  
058   sd=sort(data); 
059   empdistr(sd,[sd, wweibcdf(sd,ahat,chat)],plotflag) 
060   title([deblank(['Empirical and Weibull estimated cdf'])]) 
061 end 
062  
063

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