Home > chronux > 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 figure('Name','fig8_1: logistic regression');
0013 lfplot(fit,'contour');
0014 hold on;
0015 u = find(y==0);
0016 plot(x1(u),x2(u),'.');
0017 u = find(y==1);
0018 plot(x1(u),x2(u),'.','color','red');
0019 hold off;
0020 
0021 py = fitted(fit)>0.5;
0022 disp('Classification table for training data');
0023 tabulate(10*y+py);
0024 
0025 load cltest;
0026 py = predict(fit,[x1 x2])>0;
0027 disp('Classification table for test data');
0028 tabulate(10*y+py);

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