How to plot contour for gaussian copula (etc.)

21 visualizzazioni (ultimi 30 giorni)
Chen Yu Yuan
Chen Yu Yuan il 25 Feb 2024
Risposto: Gautam il 29 Ago 2024
From matlab help center, I can generate Gaussian copula random variables and plot it like this:
n = 500;
rng('default') % for reproducibility
U = copularnd('Gaussian',[1 .8; .8 1],n);
plot(U(:,1),U(:,2),'.')
title('{\it\rho} = 0.8')
xlabel('U1')
ylabel('U2')
The question is, how could i plot the "contour plots" of bivariate copula models like this (the right pic):
It may probabilily be marginally normalized, but i don't know how to do it by function "contour".
Thanks for your helping!!
  2 Commenti
Mann Baidi
Mann Baidi il 25 Feb 2024
Hi,
Have you tried 'copulapdf' function? If not, you can refer to the following link:

Accedi per commentare.

Risposte (1)

Gautam
Gautam il 29 Ago 2024
You can use the “copulapdf” function to plot a bivariate gaussian copula pdf and then use the “contour” on these pdf values function for the contour plot.
The code below generates the pdf
u = linspace(0,1,25);
[u1,u2] = meshgrid(u,u);
y = copulapdf('Gaussian',[u1(:),u2(:)],[1 .8; .8 1]);
surf(u1,u2,reshape(y,25,25));
Using the “contour” command on this pdf will give you the contour plot.
contour(reshape(y, 25,25), 15);

Categorie

Scopri di più su Contour Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by