www.gusucode.com > stats 源码程序 matlab案例代码 > stats/FitParetoTailsToAProbabilityDistributionExample.m

    %% Fit Pareto Tails to a Probability Distribution
%

% Copyright 2015 The MathWorks, Inc.


%%
% Generate sample data containing 100 random numbers from a _t_
% distribution with 3 degrees of freedom.
rng default;  % For reproducibility
t = trnd(3,100,1);

%%
% Fit pareto tails to the distribution at cumulative probabilities 0.1 and
% 0.9.
obj = paretotails(t,0.1,0.9);
[p,q] = boundary(obj);

%%
% Plot the cdf of the Pareto tails and the cdf of the fitted _t_
% distribution on the same figure.
x = linspace(-5,5);
plot(x,cdf(obj,x),'b-','LineWidth',2)
hold on;
plot(x,tcdf(x,3),'r:','LineWidth',2)
plot(q,p,'bo','LineWidth',2,'MarkerSize',5)
legend('Pareto Tails Object','t Distribution',...
       'Location','NW')
hold off;