Home > chronux > locfit > Book > fig8_3.m

fig8_3

PURPOSE ^

Local Regression and Likelihood, Figure 8.3.

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Local Regression and Likelihood, Figure 8.3.

 Discrimination/Classification, iris data for different
 smooting paramters.

 Note that the iris.mat file contains the full iris dataset;
 only Versicolor and Virginica are used in this example.

 The `Species' variable contains species names. `Specn' has
 them numerically, Setosa=1, Versicolor=2, Virginica=3.

 Author: Catherine Loader

 Need: get contour plot correct.
 Need: distinguish colors in plot.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Local Regression and Likelihood, Figure 8.3.
0002 %
0003 % Discrimination/Classification, iris data for different
0004 % smooting paramters.
0005 %
0006 % Note that the iris.mat file contains the full iris dataset;
0007 % only Versicolor and Virginica are used in this example.
0008 %
0009 % The `Species' variable contains species names. `Specn' has
0010 % them numerically, Setosa=1, Versicolor=2, Virginica=3.
0011 %
0012 % Author: Catherine Loader
0013 %
0014 % Need: get contour plot correct.
0015 % Need: distinguish colors in plot.
0016 
0017 load iris;
0018 a = (2:9)/10;
0019 z = zeros(size(a));
0020 
0021 u = find(Specn >= 2);
0022 pw = PetalWid(u);
0023 pl = PetalLen(u);
0024 y = (Specn(u)==3);
0025 
0026 for i = 1:length(a)
0027   fit = locfit([pw pl],y,'deg',1,'alpha',a(i),'ev','cros','scale',0,'family','binomial');
0028   fv = fitted(fit);
0029   tb = tabulate(10*y+(fv>=0.5))
0030   z(i) = sum(y == (fv<=0.5));
0031 end;
0032 
0033 [a; z]
0034 
0035 fit = locfit([pw pl],y,'deg',1,'scale',0,'family','binomial');
0036 figure('Name','fig8_3: iris classification');
0037 lfplot(fit,'contour');
0038

Generated on Fri 28-Sep-2012 12:34:30 by m2html © 2005