[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Gaussian copula
From: |
Ben Abbott |
Subject: |
Re: Gaussian copula |
Date: |
Sun, 4 May 2008 14:11:57 -0400 |
On May 4, 2008, at 10:25 AM, Dorian wrote:
2008/4/4 Ben Abbott <address@hidden>:
On Apr 3, 2008, at 11:44 AM, Dorian wrote:
hi all,
Is there a simple way to plot a gaussian copula with octave ?
Any hint will be very appreciated
Thanks in advance
In the event you're looking for a function to calculate the curve,
there is one at the link below.
http://www.koders.com/matlab/fid26069CC4A023DEC477427496F77F5EB8A2A8412C.aspx
You'll need the following function also.
http://www.koders.com/matlab/fid950678C6674B791F9548A1595C8CFC013A3F7FFC.aspx
An example is below,
u = linspace(0.01,0.99,101);
v = u;
alpha = 0.5;
[u, v] = meshgrid (u, v);
z = copulapdf ('gaussian', u, v, alpha);
mesh (u, v, z)
xlabel ("u")
ylabel ("v")
zlabel ("copula")
hello,
I had used all the link you sent, and I got many nice plot for
different copula densities .
Now I am dealing with matrices U and V which have entries 0 and 1.
Is there a simple way to plot in that case the copula densities say
c(U,V) , depend on U and V.
How could I set "alpha" .
I'm getting error of size when "alpha" as an array according to
the range of copula .
Thanks ,
I'm not familiar with these functions, or the underlying algorithms.,
but it appears the help provided by the function answers your questions.
> help copulapdf
FUNCTION C = COPULAPDF(FAMILY, U, ALPHA)
Return c(u,v|ALPHA), the copula density.
INPUTS
FAMILY: one of {'ind', 'gaussian', 'gumbel' 'clayton' 'frank'
'amh' 'joe' 'fgm' 'arch12' 'arch14'}
U: Nx2 vector (u,v) in [0,1]^2.
ALPHA: 1xM vector of copula parameters
or
COPULAPDF(FAMILY, U1, U2, ALPHA)
U1, U2: Matrices or row vectors.
If U1 is (1xN) and U2 is (1xM), c is (NxM)
If U1 is (NxM), U2 must be (N,M).
ALPHA: Scalar copula parameter
OUTPUT
C: Copula density c(u,v|ALPHA) (NxM).
So if I've inferred what you're hoping to do, try
u = linspace(0.01,0.99,101);
v = linspace(0.01,0.99,101);
% the 2nd input contains both u & v
U = [u(:), v(:)];
% I don't know what a reasonable range for alpha is, but I'll try 0 to 1
alpha = linspace(0,1,11);
z = copulapdf ('gaussian', U, alpha);
[x, y] = meshgrid (alpha, u);
mesh (x, y, log10(z))
xlabel("Alpha")
ylabel("u")
There is no need for "u" and "v" to be identical, but they do need to
be the same length.
Ben