Prev: dlnode function
Next: Count ASCII value
From: Martin Richter on 29 Dec 2009 11:40 Hi Is there anyone who has build and will share code simulating Clayton n-copula n>2 ? Martin
From: Martin Richter on 30 Dec 2009 08:42 "Martin Richter" <mar.remove.to.at.ssx(a)atp.dk> wrote in message <hhdbdm$3uq$1(a)fred.mathworks.com>... > Hi > > Is there anyone who has build and will share code simulating Clayton n-copula n>2 ? > > Martin Ok, no input... This is my solution, indeed it possible to extend letting alpha be a vector of size n, each entry >0 but could be different. Any comments are welcome. Martin %%%%%%%%%%%%%% function u = claytonrnd(alpha, n, m) %ClaytonRND Random matrix from a Clayton n-copula. % U = ClAYTONRND(ALPHA, N, M) returns N random vectors with size Mx1 % (U is a MxN matrix) generated from a Clayton N-Copula with parameters % alpha>0 v = rand(m, n); u = v; if alpha < sqrt(eps) % Assuming alpha=0, independence, just return the v else for j=2:n beta = -1/alpha - j + 1; f = sum(u(:,1:j-1).^(-alpha), 2) - j + 2; u(:,j) = (f.*(v(:,j).^(1/beta) - 1) + 1).^(-1/alpha); end end % end claytonrnd
|
Pages: 1 Prev: dlnode function Next: Count ASCII value |