annotate rDiff/src/locfit/m/aicplot.m @ 0:0f80a5141704

version 0.3 uploaded
author vipints
date Thu, 14 Feb 2013 23:38:36 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
1 function g=aicplot(alpha,varargin)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
2 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
3 % Computes and plots the -2*AIC
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
4 % for local fits with different smoothing parameters.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
5 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
6 % The first argument to aicplot(), alpha, should be a matrix with one
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
7 % or two columns (first column = nearest neighbor component, second
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
8 % column = constant component). Each row of this matrix is, in turn,
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
9 % passed as the 'alpha' argument to aic() (and locfit()). The results
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
10 % are stored in a matrix, and aic score ploted against the degrees of
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
11 % freedom.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
12
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
13 k = size(alpha,1);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
14 z = zeros(k,4);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
15
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
16 for i=1:k
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
17 z(i,:) = aic(varargin{:},'alpha',alpha(i,:));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
18 end;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
19
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
20 plot(z(:,3),z(:,4));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
21 xlabel('Fitted DF');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
22 ylabel('AIC');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
23
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
24 g = [alpha z];
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
25 return;