% PLOT_APD_PDF.M % PLOTAPDPDFSURF.M plots 2D-graphs corresponding to the pdfs of an % APD random variable with parameters ALPHA and LDA. Here both ALPHA % and LDA are held fixed. % % Comments: % a standard APD(alpha,lda) random variable X has probability density: % p(alpha,lda,x) = [A^(1/lda)/gamma(1+1/lda)]*... % *exp[-(A/alpha^lda)*abs(x)^lda], if x <= 0, % *exp[-(A/(1-alpha)^lda)*abs(x)^lda], if x > 0, % where A = (2*alpha^lda*(1-alpha)^lda)/(alpha^lda+(1-alpha)^lda). % % References: % [1] Komunjer, I. (2006): "Asymmetric Power Distribution: Theory and % Applications to Risk Measurement" % % Author: Ivana Komunjer - UCSD (komunjer@ucsd.edu) % Version: 2.1 Date: 06/07/2006 % Inputs the values of lda lda = [0.7;1;2;4]; alpha = [0.1; 0.2; 0.3; 0.5]; % Controls the precision of the plot Nprec = 501; % number of points on the grid % First define X and Y axis: X = x and Y = alpha x = (-5:(10/Nprec):5)'; y = alpha; resden = zeros(size(x,1),size(alpha,1),size(lda,1)); for j = 1:1:size(lda,1) den = []; for i = 1:1:size(alpha,1) d = APDpdf(alpha(i)*ones(size(x)),lda(j)*ones(size(x)),x); den = [den,d]; end resden(:,:,j) = den; end subplot(2,2,1); hold on; for i = 1:1:size(alpha,1) plot(x,resden(:,i,1)); axis([-5 5 0 0.6]); end hold off; title('Lambda = 0.7'); subplot(2,2,2); hold on; for i = 1:1:size(alpha,1) plot(x,resden(:,i,2)); axis([-5 5 0 0.6]); end hold off; title('Lambda = 1'); subplot(2,2,3); hold on; for i = 1:1:size(alpha,1) plot(x,resden(:,i,3)); axis([-5 5 0 0.6]); end hold off; title('Lambda = 2'); subplot(2,2,4); hold on; for i = 1:1:size(alpha,1) plot(x,resden(:,i,4)); axis([-5 5 0 0.6]); end hold off; title('Lambda = 4');