KDEDEMO2 Demonstrate the difference between transformation- and ordinary-KDE KDEDEMO2 shows that the transformation KDE is a better estimate for Rayleigh distributed data around 0 than the ordinary KDE.
Kernel Density Estimator. | |
Create or alter KDE OPTIONS structure. | |
Plot contents of pdf structures | |
Rayleigh probability density function | |
Random matrices from a Rayleigh distribution |
001 %KDEDEMO2 Demonstrate the difference between transformation- and ordinary-KDE 002 % 003 % KDEDEMO2 shows that the transformation KDE is a better estimate for 004 % Rayleigh distributed data around 0 than the ordinary KDE. 005 006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Matlab -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%% 007 %% kdedemo2.m --- 008 %% Author : Per Andreas Brodtkorb 009 %% Created On : Fri Nov 19 13:29:53 2004 010 %% Last Modified By: Per Andreas Brodtkorb 011 %% Last Modified On: Sat Feb 05 10:54:25 2005 012 %% Update Count : 20 013 %% Status : Unknown, Use with caution! 014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 015 016 data = wraylrnd(1,300,1); 017 018 x = linspace(sqrt(eps),5,55); 019 020 f = kde(data); 021 pdfplot(f) 022 title('Ordinary KDE') 023 hold on 024 plot(x,wraylpdf(x,1),':') 025 hold off 026 027 %wnormplot((data).^(L2)) % gives a straight line => L2 = 0.5 reasonable 028 029 kopt = kdeoptset('L2',0.5); 030 031 f1 = kde(data,kopt,x); 032 figure(gcf+1) 033 pdfplot(f1) 034 title('Transformation KDE') 035 hold on 036 plot(x,wraylpdf(x,1),':') 037 hold off 038 figure(gcf-1)
Comments or corrections to the WAFO group