I have 2 datasets each containing 1000 observations. I want to calculate quantiles of each dataset separately and then plot a qqplot between them. How to do? steps required
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have 2 datasets each containing 1000 observations. I want to calculate quantiles of each dataset separately and then plot a qqplot between them. How to do? steps required
Respuestas (1)
Ayush Anand
el 12 de Dic. de 2023
Hi Payel,
You can use the “quantile” function in MATLAB to calculate the quantiles for each dataset, specifying the number of quantiles or the specific probabilities you want to calculate. Here’s an example of how you could do the same:
%Load your datasets as data1 and data2. Two sample datasets are shown below
% data1 = randn(1000,1); % Normally distributed random data
% data2 = exprnd(1,1000,1); % Exponentially distributed random data
% Step 2: Calculate the quantiles for each dataset
% You can specify the probabilities for which you want to calculate the quantiles
% For example, to calculate deciles you can use 0.1:0.1:0.9
probabilities = 0.1:0.1:0.9;
quantiles1 = quantile(data1, probabilities);
quantiles2 = quantile(data2, probabilities);
% Step 3: Create the Q-Q plot to compare the quantiles of the two datasets
qqplot(quantiles1, quantiles2);
%Customize the plot
grid on;
xlabel('Quantiles of Dataset 1');
ylabel('Quantiles of Dataset 2');
title('Q-Q Plot of Dataset 1 vs Dataset 2');
You can refer to the following pages for more information:
- https://www.mathworks.com/help/matlab/ref/quantile.html (Official documentation for the “quantile” function in MATLAB)
- https://www.mathworks.com/help/stats/qqplot.html (Official documentation for the “qqplot” function in MATLAB)
I hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Data Import and Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!