Mercurial > repos > vipints > rdiff
diff rDiff/src/locfit/m/gcvplot.m @ 0:0f80a5141704
version 0.3 uploaded
author | vipints |
---|---|
date | Thu, 14 Feb 2013 23:38:36 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rDiff/src/locfit/m/gcvplot.m Thu Feb 14 23:38:36 2013 -0500 @@ -0,0 +1,25 @@ +function g=gcvplot(alpha,varargin) +% +% 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. + +k = size(alpha,1); +z = zeros(k,4); + +for i=1:k + z(i,:) = gcv(varargin{:},'alpha',alpha(i,:)); +end; + +plot(z(:,3),z(:,4)); +xlabel('Fitted DF'); +ylabel('GCV'); + +g = [alpha z]; +return;