How to plot multiple qqplot (Observed vs. Simulations) on same single figure with same regression line?
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
ngai sheau tieh
le 29 Oct 2012
Commenté : Karen Bozanian
le 9 Sep 2022
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!
0 commentaires
Réponse acceptée
José-Luis
le 29 Oct 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.
Plus de réponses (1)
Honey
le 28 Jan 2022
Hello,
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 commentaire
Karen Bozanian
le 9 Sep 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');
Voir également
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!