How to plot multiple qqplot (Observed vs. Simulations) on same single figure with same regression line?

9 visualizaciones (últimos 30 días)
Hi,
I would like to plot multiple qq-plot (Observed vs. Simulations) in a same plot with same regression line. Below is an example of my script:
A = Observed_data(:,1); B = Simulation_01(:,1); C = Simulation_02(:,1); %Three of the datasets have the same length with different max and min value.
%I did try to used 'hold on' to plot two qqplot together...but both of them displayed with different regression line.
figure; h1 = qqplot(A,B);hold on; h2 = qqplot(A,C);
How can I make these two qqplot to share with the same line?
Thanks!

Respuesta aceptada

José-Luis
José-Luis el 29 de Oct. de 2012
You can't. Why would you want to do that? Even if you could, what would the meaning be? It's not a regression line. A straight line indicates that the two samples come from the same distribution. You are talking about making the distribution of the simulations equal. The only way that would happen is if they were identical. You could transform them to make them similar (e.g. boxcox()), but I doubt you'd make them identical.
  1 comentario
ngai sheau tieh
ngai sheau tieh el 29 de Oct. de 2012
Hi, thanks for the answer. I was just wondering if both of them shared the same straight line, which one is much more closer to the observed value. But anyway, I'm not pretty sure whether they are identical or not. I will try for the boxcox() function later. Thanks again!

Iniciar sesión para comentar.

Más respuestas (1)

Honey
Honey el 28 de En. de 2022
Hello,
After about 10 years, I have this problem as ngai sheau tieh described here. Any one can help me?
I want to plot multiple qq-plot (Observed vs. Simulations) in a same plot with the same straight line which indicates the two samples come from the same distribution.
  1 comentario
Karen Bozanian
Karen Bozanian el 9 de Sept. de 2022
For everyone looking for a solution, here is what I did (assuming we are comparing the quantiles of a given dataset vs Law1 and the same dataset vs Law2) :
hold on;
qqplot(data,law1);set(gcf,'Visible','off');
ax1 = get(gca,'Children');x1 = get(ax1,'XData');y1 = get(ax1,'YData');
x1 = cell2mat(x1(1)); y1 = cell2mat(y1(1));
qqplot(data,law2);set(gcf,'Visible','off');
ax2 = get(gca,'Children');x2 = get(ax2,'XData');y2 = get(ax2,'YData');
x2 = cell2mat(x2(1)); y2 = cell2mat(y2(1));
hold off
%% This is the desired output
figure;hold on;plot(x1,x1,'k-');plot(x2,y2,'ro');plot(x1,y1,'b+');hold off;
legend({'data quantiles','Law1 quantiles','Law2 quantiles'},'Location','best');

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by