Home > wafo > kdetools > kdedemo2.m

kdedemo2

PURPOSE ^

Demonstrate the difference between transformation- and ordinary-KDE

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 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.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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)

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003