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