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

9 次查看(过去 30 天)
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!

采纳的回答

José-Luis
José-Luis 2012-10-29
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 个评论
ngai sheau tieh
ngai sheau tieh 2012-10-29
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!

请先登录,再进行评论。

更多回答(1 个)

Honey
Honey 2022-1-28
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 个评论
Karen Bozanian
Karen Bozanian 2022-9-9
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');

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by