Mechanician
Mechanician

Reputation: 545

How to retrieve the Y axis probability values from probplot, Matlab?

I m trying to retrieve the actual y axis data ( probabilty %) from probplot handle, but I am not getting the values that I need. Instead it gives me the quantile values

% sample data 
data =[68391;54744;54682;71629;42610;54371;37500;41222;39767;65042;54706;15108;57000;55460;73360]';

% obtain the probability plot for data
h1=probplot('lognormal',data,'noref');

% retrieve the y axis data from h1
[sorted_data, indices]= sort(data);
prob(indices)=h1.YData;

% the prob values are not the actual probability values that we see in the
% plot but quantile values , how to directly retrive the probabaility
% values

I would like the probability values which we see in the plot. check the values in the prob vector in the sample code above

Upvotes: 2

Views: 347

Answers (1)

Adam
Adam

Reputation: 2777

  • Alternatively compute the probabilities from the quantiles values.

  • Probabilities shown on the y-axis are based on the _normal cumulative density function_(normcdf()) of the quantiles.

Plot

enter image description here


Code to retrieve the probability

% sample data 
data = [68391; 54744; 54682; 71629; 42610; 54371; 37500; 41222; ...
        39767; 65042; 54706; 15108; 57000; 55460; 73360]';

% obtain the probability plot for data
h1 = probplot('lognormal',data,'noref');

% quantiles
quantiles = h1.YData;

% probability 
Probability = normcdf(quantiles);

% rearrange according to the order of data 
prob = zeros(size(data));
[sorted_data, indices] = sort(data);
prob(indices) = Probability;



prob.'

    0.8333
    0.5667
    0.4333
    0.9000
    0.3000
    0.3667
    0.1000
    0.2333
    0.1667
    0.7667
    0.5000
    0.0333
    0.7000
    0.6333
    0.9667

Upvotes: 3

Related Questions