


Computes and plots the Likelihood Cross-Validation score (LCV) for local fits with different smoothing parameters. Usage: g=lcvplot(alpha,varargin) The first argument to lcvplot(), alpha, should be a matrix with one or two columns (first column = nearest neighbor component, second column = constant component). Each row of this matrix is, in turn, passed as the 'alpha' argument to lcv() (and locfit()). The results are stored in a matrix, and LCV score ploted against the degrees of freedom.


0001 function g=lcvplot(alpha,varargin) 0002 % Computes and plots the Likelihood Cross-Validation score (LCV) 0003 % for local fits with different smoothing parameters. 0004 % 0005 % Usage: g=lcvplot(alpha,varargin) 0006 % 0007 % 0008 % The first argument to lcvplot(), alpha, should be a matrix with one 0009 % or two columns (first column = nearest neighbor component, second 0010 % column = constant component). Each row of this matrix is, in turn, 0011 % passed as the 'alpha' argument to lcv() (and locfit()). The results 0012 % are stored in a matrix, and LCV score ploted against the degrees of 0013 % freedom. 0014 0015 k = size(alpha,1); 0016 z = zeros(k,4); 0017 0018 for i=1:k 0019 z(i,:) = lcv(varargin{:},'alpha',alpha(i,:)); 0020 end; 0021 0022 plot(z(:,3),z(:,4)); 0023 xlabel('Fitted DF'); 0024 ylabel('LCV'); 0025 0026 g = [alpha z]; 0027 return;