% PLOT_APD_STAT.M % PLOTAPDSTAT.M plots the 2D-graphs corresponding to the first four moments of % an Asymetric Power Distributed (APD) random variable. % Here LDA is held fixed and ALPHA varies in (0,1). % % 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 % Controls the precision of the plot Nprec = 51; % number of points on the grid % First define X and Y axis: X = alpha and Y = lda m1 = []; m2 = []; m3 = []; m4 = []; alpha = [((1/Nprec):(1/Nprec):0.5)';0.5;((0.5+1/Nprec):(1/Nprec):(1-1/Nprec))']; lda = [0.7;1;2;4]; x = alpha; for i = 1:1:size(lda,1) m = APDstat(alpha,lda(i)*ones(size(alpha))); m1 = [m1,m(:,1)]; m2 = [m2,m(:,2)]; m3 = [m3,m(:,3)]; m4 = [m4,m(:,4)]; end subplot(2,2,1); hold on; for i=1:1:size(lda,1) plot(alpha,m1(:,i)); axis([0 1 -5 5]); end hold off; title('Mean'); subplot(2,2,2); hold on; for i=1:1:size(lda,1) plot(alpha,m2(:,i)); axis([0 1 0 20]); end hold off; title('Variance'); subplot(2,2,3); hold on; for i=1:1:size(lda,1) plot(alpha,m3(:,i)); axis([0 1 -3 3]); end hold off; title('Skewness'); subplot(2,2,4); hold on; for i=1:1:size(lda,1) plot(alpha,m4(:,i)); axis([0 1 2 20]); end hold off; title('Kurtosis');