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

조회 수: 7 (최근 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');

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by