Home > wafo > kdetools > kernelstats.m

kernelstats

PURPOSE ^

Return 2'nd order moment of kernel pdf

SYNOPSIS ^

[mu2, R, Rdd] = kernelstats(kernel)

DESCRIPTION ^

 KERNELSTATS Return 2'nd order moment of kernel pdf 
             as well as the integral of the squared kernel 
             and integral of squared double derivative of kernel. 
    
   CALL:  [mu2, R, Rdd] = kernelstats(kernel) 
    
  mu2    = 2'nd order moment, i.e.,int(x^2*kernel(x)) 
  R      = integral of squared kernel, i.e., int(kernel(x)^2) 
  Rdd    = integral of squared double derivative of kernel, i.e.,  
           int( (kernel''(x))^2 ). 
  kernel = string identifying the kernel, i.e., one of: 
             'epanechnikov'  - Epanechnikov kernel. 
             'biweight'      - Bi-weight kernel. 
             'triweight'     - Tri-weight kernel.   
             'triangluar'    - Triangular kernel. 
             'gaussian'      - Gaussian kernel 
             'rectangular'   - Rectanguler kernel.  
             'laplace'       - Laplace kernel. 
             'logistic'      - Logistic kernel.   
  
   Note that only the first 4 letters of the kernel name is needed. 
  
  Example 
   [mu2,R]=kernelstats('triweight')   
  
  See also  mkernel

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function [mu2, R, Rdd] = kernelstats(kernel) 
002 %KERNELSTATS Return 2'nd order moment of kernel pdf 
003 %            as well as the integral of the squared kernel 
004 %            and integral of squared double derivative of kernel. 
005 %   
006 %  CALL:  [mu2, R, Rdd] = kernelstats(kernel) 
007 %   
008 % mu2    = 2'nd order moment, i.e.,int(x^2*kernel(x)) 
009 % R      = integral of squared kernel, i.e., int(kernel(x)^2) 
010 % Rdd    = integral of squared double derivative of kernel, i.e.,  
011 %          int( (kernel''(x))^2 ). 
012 % kernel = string identifying the kernel, i.e., one of: 
013 %            'epanechnikov'  - Epanechnikov kernel. 
014 %            'biweight'      - Bi-weight kernel. 
015 %            'triweight'     - Tri-weight kernel.   
016 %            'triangluar'    - Triangular kernel. 
017 %            'gaussian'      - Gaussian kernel 
018 %            'rectangular'   - Rectanguler kernel.  
019 %            'laplace'       - Laplace kernel. 
020 %            'logistic'      - Logistic kernel.   
021 % 
022 %  Note that only the first 4 letters of the kernel name is needed. 
023 % 
024 % Example 
025 %  [mu2,R]=kernelstats('triweight')   
026 % 
027 % See also  mkernel 
028    
029 % Reference  
030 %  Wand,M.P. and Jones, M.C. (1995)  
031 % 'Kernel smoothing' 
032 %  Chapman and Hall, pp 176. 
033    
034 %History 
035 % by pab Dec2003 
036    
037 switch lower(kernel(1:4)) 
038  case 'biwe', % Bi-weight kernel 
039   mu2 = 1/7; 
040   R   = 5/7; 
041   Rdd = 45/2; 
042  case {'epan' 'epa1'}, % Epanechnikov kernel 
043   mu2 = 1/5; 
044   R   = 3/5; 
045   Rdd = inf; 
046  case {'gaus','norm'}, % Gaussian kernel 
047   mu2 = 1; 
048   R   = 1/(2*sqrt(pi)); 
049   Rdd = 3/(8*sqrt(pi)); 
050  case  'lapl', % Laplace 
051   mu2 = 2;  
052   R   = 1/4; 
053   Rdd = inf; 
054  case 'logi', % Logistic 
055   mu2 = pi^2/3; 
056   R=1/6; 
057   Rdd = 1/42; 
058  case {'rect','unif'}, % Rectangular 
059   mu2 = 1/3; 
060   R   = 1/2; 
061   Rdd = inf; 
062  case 'tria', % Triangular 
063   mu2 = 1/6; 
064   R   = 2/3; 
065   Rdd = inf; 
066  case 'triw', % Triweight 
067   mu2 = 1/9; 
068   R   = 350/429; 
069   Rdd = inf; 
070  otherwise 
071   error('Unknown kernel.') 
072 end;

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