View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Inverse Percentiles of a sample.

4.3 | 4 ratings Rate this file 36 Downloads (last 30 days) File Size: 8.4 KB File ID: #41131 Version: 1.2
image thumbnail

Inverse Percentiles of a sample.



04 Apr 2013 (Updated )

Calculates the non-exceedance probability (inverse of prctile) for xq values from sample of data x.

| Watch this File

File Information

         p = INVPRCTILE(x,xq)
         p = INVPRCTILE(x,xq,dim)
         p = INVPRCTILE(x,xq,dim,plot_pos)
    x - Vector or Matrix of sample data
    q - Values for non-exceedance probabilities to be computed.
        q can be scalar or vector
 dim - Dimension for matrix to be worked for non-exceedance probability
plot_pos - plotting positions that determine interpolation method

    p - Non-exceedance probabilities values for q.

When x is a vector, p is the same size as xq, and p(i) contains the non-exceedance probability for xq(i) value.

When x is a matrix, the i-th row of p contains
the non-exceedance probability for xq(i)-values of each column of x.

For N-D arrays, INVPRCTILE operates along the first non-singleton dimension.
    x = rand(100,1);
    q = [0.1 0.25 0.8];
    p = invprctile(x,q);
    % Check with prctile to get back the same results
    qvalues = prctile(x,p)

MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
24 Mar 2016 Salman Zaferanlouei

24 Mar 2016 Salman Zaferanlouei

05 Mar 2014 Julia Mikhalevsky

09 Sep 2013 Terry

Terry (view profile)

Nice one! Seems to work well.

Would be nice to add a check that if only one argin is entered (one column/vector) - then it calcs inverse prctile on each entry of the column/vector.

For example, I have a vector
myvector=[0.8 0.5 .2 0.6 0.8 0.5 0.3 0.6 0.9 1.3]'
and I want to find what percentile each corresponds to, so I run

It would be a bit cleaner to be able to just call invprctile(myvector)

05 Apr 2013 1.1

Bug fixing for not strictly monotonic increasing x values

11 Sep 2014 1.2

1. Fixing behaviour of unique function after MATLAB R2012b

2. Possibility to use different plotting position

Contact us