www.gusucode.com > stats 源码程序 matlab案例代码 > stats/QuantileQuantilePlotForWeibullDistributionExample.m
%% Quantile-Quantile Plot for Weibull Distribution %% % Use a quantile-quantile plot to determine whether sample data comes from % a Weibull distribution. %% % Load the sample data. load(fullfile(matlabroot,'examples','stats','lightbulb.mat')) %% % The first column of the data has the lifetime (in hours) of two types of % lightbulbs. The second column has information about the type of light % bulb. 1 indicates fluorescent bulbs whereas 0 indicates the incandescent % bult. The third column has censoring information. 1 indicates censored % data, and 0 indicates the exact failure time. This is simulated data. %% % Remove the censored data. lightbulb = [lightbulb(lightbulb(:,3)==0,1),... lightbulb(lightbulb(:,3)==0,2)]; %% % Create a variable for each light bulb type. Include only uncensored data. fluo = [lightbulb(lightbulb(:,2)==0,1)]; insc = [lightbulb(lightbulb(:,2)==1,1)]; %% % Create a Weibull probability distribution object using the default % parameters of |A = 1| and |B = 1|. pd = makedist('Weibull'); %% % Create a q-q plot to determine whether the lifetime of fluorescent bulbs % has a Weibull distribution. figure qqplot(fluo,pd) %% % The plot is not a straight line, suggesting that the lifetime % data for fluorescent bulbs does not follow a Weibull distribution.