Hi Hamed,
Since you did not provide the data, the plot cannot be generated. However, to perform cross-quantile correlation analysis, you can follow my provided example code snippet. It generates random data for two variables, calculates quantiles, computes the correlation between quantiles, and visualizes the correlation matrix as a heatmap. By executing this code, you can analyze the relationship between the quantiles of two variables visually through the heatmap, providing insights into their cross-quantile correlation patterns. Please modify the code based on your preferences.
% Generate random data
data1 = randn(100, 1); % Random data for variable 1
data2 = randn(100, 1); % Random data for variable 2
% Calculate quantiles
quantiles1 = quantile(data1, [0.25, 0.5, 0.75]); % Quantiles for variable 1
quantiles2 = quantile(data2, [0.25, 0.5, 0.75]); % Quantiles for variable 2
% Calculate cross-quantile correlation
corr_matrix = zeros(3, 3); % Initialize correlation matrix
for i = 1:2 % Adjusted loop range to prevent index exceeding for j = 1:2 % Adjusted loop range to prevent index exceeding corr_matrix(i, j) = corr(data1(data1 >= quantiles1(i) & data1 <= quantiles1(i+1)), ...
data2(data2 >= quantiles2(j) & data2 <= quantiles2(j+1))); end end
% Plot the heatmap
heatmap(corr_matrix, 'XData', {'Q1', 'Q2', 'Q3'}, 'YData', {'Q1', 'Q2', 'Q3'});
title('Cross-Quantile Correlation Heatmap');
xlabel('Variable 1 Quantiles');
ylabel('Variable 2 Quantiles');
For more information on function heatmap, please refer to
https://www.mathworks.com/help/matlab/ref/heatmap.html
Please see attached plot.