segment

Class: piecewisedistribution

Segments containing values

Syntax

S = segment(obj,X,P)

Description

S = segment(obj,X,P) returns an array S of integers indicating which segment of the piecewise distribution object obj contains each value of X or, alternatively, P. One of X and P must be empty ([]). If X is nonempty, S is determined by comparing X with the quantile boundary values defined for obj. If P is nonempty, S is determined by comparing P with the probability boundary values.

Examples

Fit Pareto tails to a t distribution at cumulative probabilities 0.1 and 0.9:

t = trnd(3,100,1);
obj = paretotails(t,0.1,0.9);

pvals = 0:0.2:1;
s = segment(obj,[],pvals)
s =
     1     2     2     2     2     3
Was this topic helpful?