Calculate the conditional distribution using copulas

36 visualizaciones (últimos 30 días)
Murielle van Pampus
Murielle van Pampus el 10 de En. de 2022
Respondida: Alan el 18 de Mzo. de 2024
Hi all,
As I have determined the best fitted copula to a data set, I need to determine the conditional distributions of these copulas:
For this determination I want to calculate the PDF of the distributions of X and Y=y and determine het cumulative integral of the PDF's. The distribution I should use for the conditional distribution is 'Gumbel'.
gaus_cdf = copulacdf('Gaussian',[x(:),y(:)],0.6436);
clay_cdf = copulacdf('Clayton',[x(:),y(:)],a_clay);
gumb_cdf = copulacdf('Gumbel',[x(:),y(:)],d_gumb);
t_cdf = copulacdf('t',[x(:),y(:)],0.7055,nu);
frank_cdf = copulacdf('Frank',[x(:),y(:)],a_frank);
gaus_pdf = copulapdf('Gaussian',[x(:),y(:)],0.6436);
clay_pdf = copulapdf('Clayton',[x(:),y(:)],a_clay);
gumb_pdf = copulapdf('Gumbel',[x(:),y(:)],d_gumb);
t_pdf = copulapdf('t',[x(:),y(:)],0.7055,nu);
frank_pdf = copulapdf('Frank',[x(:),y(:)],a_frank);
surf(x,y,reshape(gumb_pdf,50,50))
%surf(x,y,ecdf)
xlabel('Temperature')
ylabel('Sunshine duration')
title('CDF Gumbel Copula')
Using the code above, the PDF's and the CDF's can be displayed in 3D, but I need the copulas depictered in 2D. Can anyone help me how to manage this correctly? The plot should like a bit like this:
In this plot, the conditional distribution of P(X=x | Y=y_50) (blue line) and P(X=x|Y=y_90) (pink line) should be plotted.
Thank you!

Respuestas (1)

Alan
Alan el 18 de Mzo. de 2024
Hi Murielle,
From what I understand, you aim to plot the conditional probability derived from a Gumbel copula given values of Y. First, we can get the copula PDF using the “copulapdffunction which can be utilized as follows:
x = 0:0.1:1;
y=x;
[x, y] = meshgrid(x, y);
gumb_pdf = copulapdf('Gumbel', [x(:), y(:)], 2); % Using 2 as alpha
gumb_pdf = reshape(gumb_pdf, 11, 11);
Then, we can obtain the conditional probabilities by selecting the rows that correspond to the required Y values:
gumb_pdf_y_50 = gumb_pdf(6, :); % Selecting the 6th row for y=0.5
gumb_pdf_y_90 = gumb_pdf(end-1, :); % Selecting the 10th row for y=0.9
Finally, we can visualize the probabilities using “plot”:
plot(0:0.1:1, gumb_pdf_y_50);
hold on;
plot(0:0.1:1, gumb_pdf_y_90);
legend(["Y=0.5", "Y=0.9"], 'Location','northwest');
hold off;
The same can be done with CDFs by using the "copulacdf" function.
I hope this helped.

Categorías

Más información sobre Probability Distributions en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by