Home > chronux_1_1 > locfit > Book > fig8_1.m

fig8_1

PURPOSE ^

Local Regression and Likelihood, Figure 8.1.

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Local Regression and Likelihood, Figure 8.1.

 Discrimination/Classification, simple example using
 logistic regression.

 Author: Catherine Loader

 NEED: level=0.5 for contour plot.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Local Regression and Likelihood, Figure 8.1.
0002 %
0003 % Discrimination/Classification, simple example using
0004 % logistic regression.
0005 %
0006 % Author: Catherine Loader
0007 %
0008 % NEED: level=0.5 for contour plot.
0009 
0010 load cltrain;
0011 fit = locfit([x1 x2],y,'family','binomial','scale',0);
0012 lfplot(fit,'contour');
0013 hold on;
0014 u = find(y==0);
0015 plot(x1(u),x2(u),'.');
0016 u = find(y==1);
0017 plot(x1(u),x2(u),'.','color','red');
0018 hold off;
0019 
0020 py = fitted(fit)>0.5;
0021 disp('Classification table for training data');
0022 tabulate(10*y+py);
0023 
0024 load cltest;
0025 py = predict(fit,[x1 x2])>0;
0026 disp('Classification table for test data');
0027 tabulate(10*y+py);

Generated on Sun 13-Aug-2006 11:49:44 by m2html © 2003