Generate a sample data set and fit a piecewise distribution with a Pareto tail to the data by using paretotails. Find the number of segments in the fitted distribution by using the object function nsegments.
Generate a sample data set containing 10% outliers in the right tail.
rng('default'); % For reproducibility
right_tail = exprnd(5,100,1);
center = randn(900,1);
x = [center;right_tail];
Create a paretotails object by fitting a piecewise distribution to x. Specify the boundaries of the tails using the lower and upper tail cumulative probabilities. Pass in 0 and 0.9 so that a fitted object does not contain a lower tail segment, and consists of the empirical distribution for the lower 90% of the data set and a generalized Pareto distribution (GPD) for the upper 10% of the data set.
pd = paretotails(x,0,0.9)
pd =
Piecewise distribution with 2 segments
-Inf < x < 1.73931 (0 < p < 0.9): interpolated empirical cdf
1.73931 < x < Inf (0.9 < p < 1): upper tail, GPD(0.643752,1.62246)
Return the number of segments in pd by using the nsegments function.
n = nsegments(pd)
n =
2
You can also get the number of segments by using the NumSegments property. Access the NumSegments property by using dot notation.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.