gcvplot

PURPOSE ^

SYNOPSIS ^

function g=gcvplot(alpha,varargin)

DESCRIPTION ^

 Computes and plots the Generalized Cross-Validation score (GCV)
 for local fits with different smoothing parameters.

 The first argument to gcvplot(), 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 gcv() (and locfit()). The results
 are stored in a matrix, and GCV score ploted against the degrees of
 freedom.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Fri 12-Aug-2011 11:36:15 by m2html © 2005