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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.