Home > wafo > cycles > smoothcmat_hnorm.m

smoothcmat_hnorm

PURPOSE ^

Bandwidth selection for kernel smoothing of a cycle matrix.

SYNOPSIS ^

h_norm = smoothcmat_hnorm(F,NOsubzero)

DESCRIPTION ^

 SMOOTHCMAT_HNORM  Bandwidth selection for kernel smoothing of a cycle matrix.  
  
  CALL: h_norm = smoothcmat_hnorm(F); 
        h_norm = smoothcmat_hnorm(F,NOsubzero); 
  
  Input: 
  F       = Cycle matrix.           [nxn] 
  NOsubzero=Number of subdiagonals that are zero 
            (Optional, Default = 0, only the diagonal is zero) 
  
  Output: 
  h_norm    = Selected bandwidth. 
  
  This choice is optimal if the sample is from a normal distribution 
  The normal bandwidth usualy oversmooths, therefore one should choose  
  a slightly smaller bandwidth, e.g.  h=0.7*h_norm 
  
  See also  cc2cmat, tp2rfc, tp2mm, dat2tp.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function h_norm = smoothcmat_hnorm(F,NOsubzero) 
002  
003 %SMOOTHCMAT_HNORM  Bandwidth selection for kernel smoothing of a cycle matrix.  
004 % 
005 % CALL: h_norm = smoothcmat_hnorm(F); 
006 %       h_norm = smoothcmat_hnorm(F,NOsubzero); 
007 % 
008 % Input: 
009 % F       = Cycle matrix.           [nxn] 
010 % NOsubzero=Number of subdiagonals that are zero 
011 %           (Optional, Default = 0, only the diagonal is zero) 
012 % 
013 % Output: 
014 % h_norm    = Selected bandwidth. 
015 % 
016 % This choice is optimal if the sample is from a normal distribution 
017 % The normal bandwidth usualy oversmooths, therefore one should choose  
018 % a slightly smaller bandwidth, e.g.  h=0.7*h_norm 
019 % 
020 % See also  cc2cmat, tp2rfc, tp2mm, dat2tp. 
021  
022 % Tested  on Matlab  5.3 
023 % 
024 % History: 
025 % Created by PJ (Pär Johannesson) 18-Oct-2000 
026 %   from  'smoothcmat' 
027  
028 % Check input arguments 
029  
030 ni = nargin; 
031 no = nargout; 
032 error(nargchk(1,2,ni)); 
033  
034 if ni<2, NOsubzero=[]; end 
035  
036 if isempty(NOsubzero), NOsubzero=0; end 
037  
038 n = length(F);    % Size of matrix 
039 N = sum(sum(F));  % Total number of cycles 
040  
041 d = 2;   % 2-dim 
042 [I,J] = meshgrid(1:n,1:n); 
043  
044 % Choosing bandwidth 
045 % This choice is optimal if the sample is from a normal distr. 
046 % The normal bandwidth usualy oversmooths, 
047 % therefore we choose a slightly smaller bandwidth 
048  
049 h0 = N^(-1/(d+4)); 
050 FF = F+F'; 
051 mean_F = sum(sum(FF).*(1:n))/N/2; 
052 s2 = sum(sum(FF).*((1:n)-mean_F).^2)/N/2; 
053 s = sqrt(s2);       % Mean of std in each direction 
054 h_norm = s*h0;      % Optimal for Normal distr. 
055 h = h_norm;         % Test 
056

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