Need some help with plotting: I'm calculating probability of detection (Pd) as a function of number of pulses (N). Is there any way to scale the Pd axis to match a probability paper display? I'm familiar with functions such as probplot and normplot but I think they are useless in my case (my data is already probability values).

6 commentaires

bym
bym le 27 Juin 2011
I am curious as to why you think that probplot is not applicable
Amital
Amital le 29 Juin 2011
"...probplot(Y) produces a normal probability plot comparing the distribution of the data Y to the normal distribution".
The probplot creates a graph of probability vs data values. In my case, my data is already probability values, which I'd like to plot vs the number of pulses.
bym
bym le 29 Juin 2011
perhaps you can post some data? I am failing to grasp the problem sufficiently to provide a useful answer
Amital
Amital le 2 Juil 2011
I'm new to "MATLAB Answers" . . . can I attach my files to this question? can I send you directly the code and explanation?
bym
bym le 4 Juil 2011
just give some sample data, there is no way to attach sample data except via 3rd party host site
Amital
Amital le 16 Juil 2011
For example:
N = 1:50;
Pd = [ 0.000383300630824923 0.00304135866412469 0.0115018297345039 0.0299724820999226 0.0620021866776590 0.109393828951169 0.171732062381264 0.246552187406658 0.329955743864937 0.417405529850324 0.504469775589605 0.587373712581881 0.663308835662832 0.730518912100307 0.788219407087160 0.836417608881746 0.875693476402896 0.906985359331223 0.931407248664091 0.950109249769390 0.964182240138594 0.974601251259546 0.982199211646827 0.987662230603251 0.991538575189021 0.994255111160449 0.996136711333829 0.997425684412606 0.998299510385346 0.998886064327547 0.999276105246741 0.999533163271662 0.999701142182148 0.999810022829196 0.999880051534573 0.999924758662280 0.999953097907271 0.999970939636442 0.999982099032798 0.999989035045252 0.999993320015178 0.999995951806419 0.999997559162203 0.999998535534269 0.999999125521121 0.999999480227800 0.999999692439166 0.999999818798839 0.999999893693984 0.999999937888214 ];
Now, plotting Pd as a function of N on a probability paper.

Connectez-vous pour commenter.

 Réponse acceptée

the cyclist
the cyclist le 16 Juil 2011

0 votes

Use the norminv() function to convert your Pd probability values into z-scores.
z = norminv(Pd);
figure
plot(N,z);
p_label = [0.001 0.01 0.05 0.1 0.25 0.5 0.75 0.9 0.95 0.99 0.999 0.9999 0.99999];
set(gca,'YTick',norminv(p_label))
set(gca,'YTickLabel',p_label)

3 commentaires

Oleg Komarov
Oleg Komarov le 16 Juil 2011
I used qqplot as an edit to your comment.
Amital
Amital le 18 Juil 2011
Thanks a lot. This is exactly what I was looking for.
Yimin Lim
Yimin Lim le 2 Fév 2018
Hi, is there any way to plot this while retaining the probability scale? can't really find any thread on this at all.

Connectez-vous pour commenter.

Plus de réponses (2)

Oleg Komarov
Oleg Komarov le 16 Juil 2011

0 votes

N = 1:50;
Pd = [ 0.000383300630824923 0.00304135866412469 0.0115018297345039 0.0299724820999226 0.0620021866776590 0.109393828951169 0.171732062381264 0.246552187406658 0.329955743864937 0.417405529850324 0.504469775589605 0.587373712581881 0.663308835662832 0.730518912100307 0.788219407087160 0.836417608881746 0.875693476402896 0.906985359331223 0.931407248664091 0.950109249769390 0.964182240138594 0.974601251259546 0.982199211646827 0.987662230603251 0.991538575189021 0.994255111160449 0.996136711333829 0.997425684412606 0.998299510385346 0.998886064327547 0.999276105246741 0.999533163271662 0.999701142182148 0.999810022829196 0.999880051534573 0.999924758662280 0.999953097907271 0.999970939636442 0.999982099032798 0.999989035045252 0.999993320015178 0.999995951806419 0.999997559162203 0.999998535534269 0.999999125521121 0.999999480227800 0.999999692439166 0.999999818798839 0.999999893693984 0.999999937888214 ];
f = figure;
ax = axes('Parent',f,'YScale','log','YMinorTick','on',...
'YMinorGrid','on','YGrid','on',...
'YColor',[.5 .5 .5],'XScale','log',...
'XMinorTick','on','XMinorGrid','on',...
'XGrid','on','XColor',[.5 .5 .5],...
'MinorGridLineStyle','-','box','on');
hold(ax(1),'all');
% Create loglog
loglog(N,Pd,'LineWidth',2);
% Overwrite axes to make it black keeping grey grid
prop = get(ax(1),{'Xlim','Ylim','Xtick','Ytick'});
ax(2) = axes('Parent',f,'YScale','log','XScale','log','box','on',...
'Color','none','Xlim',prop{1},'Ylim',prop{2},...
'Xtick',prop{3},'Ytick',prop{4});
The result:
EDIT: QQplot against normal
qqplot(norminv(Pd))
PS. Here Pd is a cdf

4 commentaires

the cyclist
the cyclist le 16 Juil 2011
Oleg, I am not sure this is correct. (But I am not 100% sure mine is, either!) I don't believe that a probability plot is simply a log plot. I believe it is a plot where if two points have the same z-score difference, then they have the same separation on the plot.
Oleg Komarov
Oleg Komarov le 16 Juil 2011
My bad, you're right.
Warda Panondi
Warda Panondi le 15 Nov 2019
Dear Everyone,
i will take as an oppurtunity to ask related to this topic, I just what to ask on how to plot linear probablity plot as the picture shown.
for example.
x=[ 44 38 36 35 27 26.5 26 26 24 23.5 23 23 21 20.5 19.5 19 19 19 19 19 18 18 17.6 17 17 17 16 16 16 16 14.5 14 13 11 11 10 9 8.5 ]
y = [ 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 0.974359 ]
and im looking that my result would be like this.
probabilityPlot.JPG
Hoping for your help.
Best Regards,
Warda
the cyclist
the cyclist le 15 Nov 2019
Modifié(e) : the cyclist le 15 Nov 2019
Every value in your y vector seems to identical, so you cannot get a plot that looks like that from the data you posted.

Connectez-vous pour commenter.

Larry B
Larry B le 9 Oct 2015

0 votes

Do not know if this is an issue for you anymore, but I also wanted to do CDF curves on probability paper. Cam Sulzberger, MathWorks Technical Support Department, created the below program for doing so. I added the following lines to my CDF program plotting both simulation results and theoretical curves: .... plotProbGraphPaper(a1,w1,'-k','linewidth',3); hold on plotProbGraphPaper(a1,w2,'vk','linewidth',3); hold on plotProbGraphPaper(a1,w3,'--k','linewidth',3); hold on plotProbGraphPaper(a1,w4,'sk','linewidth',3); hold on plotProbGraphPaper(a1,w5,':k','linewidth',3); hold on plotProbGraphPaper(a1,w6,'dk','linewidth',3); hold on plotProbGraphPaper(a1,w7,'-.k','linewidth',3); hold on plotProbGraphPaper(a1,w8,'dk','linewidth',3); hAx = gca; hAx.YLim(1) = norminv(0.0001); hAx.YLim(2) = norminv(0.999); hold off...
Attached is the resulting curves for a non-central Chi-Squared CDF. Pretty slick!! Thanks, Cam!!
------function plotProbGraphPaper(x,y,varargin) % plotProbGraphPaper(x,y,_) % Sets the y-axis limits and tick marks to display in the style of % probability graph paper
% Plot the data, converting to z-scores z = norminv(y); plot(x,z,varargin{:}) hAx = gca; % % Define potential tick locations ticks = [.0001 .0005 .001 .005 .01 .05 .1 .25 .5 ... .75 .9 .95 .99 .995 .999 .9999 .99995]; ticksNV = norminv(ticks);
% Remove ticks that are outside the y-axis range hAx.YLimMode = 'auto'; keepTicks = ticksNV >= hAx.YLim(1) & ticksNV <= hAx.YLim(2); ticks = ticks(keepTicks); ticksNV = ticksNV(keepTicks);
% Remove ticks that are too close together tol = 0.025*diff(hAx.YLim); iTickBack = ceil(length(ticksNV)/2); iTickFwd = iTickBack-1; keepTicks = true(size(ticksNV)); while iTickFwd > 0 if ticksNV(iTickFwd) > ticksNV(iTickBack)-tol keepTicks(iTickFwd) = false; else iTickBack = iTickFwd; end iTickFwd = iTickFwd-1; end iTickFwd = iTickBack+1; while iTickFwd < length(ticksNV) if ticksNV(iTickFwd) < ticksNV(iTickBack)+tol keepTicks(iTickFwd) = false; else iTickBack = iTickFwd; end iTickFwd = iTickFwd+1; end if ~all(keepTicks) ticks = ticks(keepTicks); ticksNV = ticksNV(keepTicks); end
% Assign the tick values and labels using norminv hAx.YTick = ticksNV; hAx.YTickLabel = ticks;
% Add grid hAx.XGrid = 'on'; hAx.XMinorGrid = 'off'; hAx.YGrid = 'on'; hAx.YMinorGrid = 'off';

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by