lcvplot.m 698 B

12345678910111213141516171819202122232425
  1. function g=lcvplot(alpha,varargin)
  2. %
  3. % Computes and plots the Likelihood Cross-Validation score (LCV)
  4. % for local fits with different smoothing parameters.
  5. %
  6. % The first argument to lcvplot(), alpha, should be a matrix with one
  7. % or two columns (first column = nearest neighbor component, second
  8. % column = constant component). Each row of this matrix is, in turn,
  9. % passed as the 'alpha' argument to lcv() (and locfit()). The results
  10. % are stored in a matrix, and LCV score ploted against the degrees of
  11. % freedom.
  12. k = size(alpha,1);
  13. z = zeros(k,4);
  14. for i=1:k
  15. z(i,:) = lcv(varargin{:},'alpha',alpha(i,:));
  16. end;
  17. plot(z(:,3),z(:,4));
  18. xlabel('Fitted DF');
  19. ylabel('LCV');
  20. g = [alpha z];
  21. return;