0
|
1 function g=gcvplot(alpha,varargin)
|
|
2 %
|
|
3 % Computes and plots the Generalized Cross-Validation score (GCV)
|
|
4 % for local fits with different smoothing parameters.
|
|
5 %
|
|
6 % The first argument to gcvplot(), 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 gcv() (and locfit()). The results
|
|
10 % are stored in a matrix, and GCV score ploted against the degrees of
|
|
11 % freedom.
|
|
12
|
|
13 k = size(alpha,1);
|
|
14 z = zeros(k,4);
|
|
15
|
|
16 for i=1:k
|
|
17 z(i,:) = gcv(varargin{:},'alpha',alpha(i,:));
|
|
18 end;
|
|
19
|
|
20 plot(z(:,3),z(:,4));
|
|
21 xlabel('Fitted DF');
|
|
22 ylabel('GCV');
|
|
23
|
|
24 g = [alpha z];
|
|
25 return;
|