| 
0
 | 
     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 
 | 
| 
 | 
    13 k = size(alpha,1);
 | 
| 
 | 
    14 z = zeros(k,4);
 | 
| 
 | 
    15 
 | 
| 
 | 
    16 for i=1:k
 | 
| 
 | 
    17   z(i,:) = lcv(varargin{:},'alpha',alpha(i,:));
 | 
| 
 | 
    18 end;
 | 
| 
 | 
    19 
 | 
| 
 | 
    20 plot(z(:,3),z(:,4));
 | 
| 
 | 
    21 xlabel('Fitted DF');
 | 
| 
 | 
    22 ylabel('LCV');
 | 
| 
 | 
    23 
 | 
| 
 | 
    24 g = [alpha z];
 | 
| 
 | 
    25 return;
 |