Computes and plots the -2*AIC for local fits with different smoothing parameters. The first argument to aicplot(), 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 aic() (and locfit()). The results are stored in a matrix, and aic score ploted against the degrees of freedom.

0001 function g=aicplot(alpha,varargin) 0002 % 0003 % Computes and plots the -2*AIC 0004 % for local fits with different smoothing parameters. 0005 % 0006 % The first argument to aicplot(), 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 aic() (and locfit()). The results 0010 % are stored in a matrix, and aic 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,:) = aic(varargin{:},'alpha',alpha(i,:)); 0018 end; 0019 0020 plot(z(:,3),z(:,4)); 0021 xlabel('Fitted DF'); 0022 ylabel('AIC'); 0023 0024 g = [alpha z]; 0025 return;

Generated on Fri 28-Sep-2012 12:34:30 by