<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Win-Vector Blog &#187; Regression</title>
	<atom:link href="http://www.win-vector.com/blog/tag/regression/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.win-vector.com/blog</link>
	<description>The Applied Theorist&#039;s Point of View</description>
	<lastBuildDate>Thu, 29 Jul 2010 17:09:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>CRU graph yet again (with R)</title>
		<link>http://www.win-vector.com/blog/2009/12/cru-graph-yet-again-with-r/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=cru-graph-yet-again-with-r</link>
		<comments>http://www.win-vector.com/blog/2009/12/cru-graph-yet-again-with-r/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 19:25:00 +0000</pubDate>
		<dc:creator>John Mount</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Climate]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Regression]]></category>

		<guid isPermaLink="false">http://www.win-vector.com/blog/?p=1195</guid>
		<description><![CDATA[IowaHawk has a excellent article attempting to reproduce the infamous CRU climate graph using OpenOffice: Fables of the Reconstruction. We thought we would show how to produced similarly bad results using R. If the re-constructed technique is close to what was originally done then so many bad moves were taken that you can&#8217;t learn much [...]


Related posts:<ol><li><a href='http://www.win-vector.com/blog/2009/11/r-examine-objects-tutorial/' rel='bookmark' title='Permanent Link: R examine objects tutorial'>R examine objects tutorial</a></li>
<li><a href='http://www.win-vector.com/blog/2009/09/survive-r/' rel='bookmark' title='Permanent Link: Survive R'>Survive R</a></li>
<li><a href='http://www.win-vector.com/blog/2010/03/r-annoyances/' rel='bookmark' title='Permanent Link: R annoyances'>R annoyances</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>IowaHawk has a excellent article attempting to reproduce the infamous CRU climate graph using OpenOffice: <a href="http://iowahawk.typepad.com/iowahawk/2009/12/fables-of-the-reconstruction.html">Fables of the Reconstruction</a>.   We thought we would show how to produced similarly bad results using R.<br />
<span id="more-1195"></span></p>
<p>If the re-constructed technique is close to what was originally done then so many bad moves were taken that you can&#8217;t learn much of anything from the original &#8220;result.&#8221;   This points out some of the pratfalls of not performing hold-out tests, not examining the modeling diagnostics and not remembering that linear regression models fail to low-variance models (i.e. when they fail they do a good job predicting the mean and vastly under-estimate variance).</p>
<p>Our article not an article on global warming, but an article on analysis technique.  Human driven global warming is either happening or not happening independent of any bad analysis.  Finding the physical truth is a bigger harder job than eliminating some bad reports (the opposite of a bad report is not necessarily the truth). Bad analyses can have many different sources (mistakes, trying to jump ahead of your colleagues on something you believe is true, trying to fake something you believe is false or be figments of overly harsh critics) and we have not heard enough to make any accusations.</p>
<p>First: load the data (I re-formatted it at bit so <a href="http://cran.r-project.org/">R</a> can read it:<a href="http://www.win-vector.com/blog/wp-content/uploads/2009/12/jonesmannrogfig2c.txt"> jonesmannrogfig2c.txt</a>,  <a href="http://www.win-vector.com/blog/wp-content/uploads/2009/12/data1400.dat_.txt">data1400.dat_.txt</a>   ) , perform the principle components reduction and fit a first<br />
model.</p>
<pre>
&gt; library(lattice)
&gt; d1400 &lt;- read.table('data1400.dat.txt',sep='\t',header=FALSE)
&gt; d1400r &lt;- as.matrix(d1400[,2:23])
&gt; pcomp &lt;- prcomp(na.omit(d1400r))
&gt; plot(pcomp)
&gt; vars &lt;- data.frame(cbind(Year=d1400[,1],d1400r %*% pcomp$rotation),row.names=d1400[,1])
&gt; jones &lt;- read.table('jonesmannrogfig2c.txt',sep='\t',header=TRUE)
&gt; datUnion &lt;- merge(vars,jones,all=TRUE)
&gt; datUnion$avgTemp &lt;- with(datUnion,(NH+CET+Central.Europe+Fennoscandia)/4.0)
&gt; model &lt;- lm(avgTemp ~ PC1 + PC2 + PC3 + PC4 + PC5 ,dat=datUnion)
&gt; summary(model)

Call:
lm(formula = avgTemp ~ PC1 + PC2 + PC3 + PC4 + PC5, data = datUnion)

Residuals:
       Min         1Q     Median         3Q        Max
-0.8811679 -0.2658117  0.0008174  0.2933058  1.0450044 

Coefficients:
              Estimate Std. Error t value Pr(&gt;|t|)
(Intercept)  0.0065252  0.5750696   0.011   0.9910
PC1         -0.0001683  0.0003912  -0.430   0.6679
PC2         -0.0003678  0.0010114  -0.364   0.7168
PC3          0.0003177  0.0014821   0.214   0.8307
PC4          0.0044084  0.0019351   2.278   0.0246 *
PC5          0.0188520  0.0205137   0.919   0.3601
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 0.4505 on 113 degrees of freedom
  (484 observations deleted due to missingness)
Multiple R-squared: 0.05223,	Adjusted R-squared: 0.01029
F-statistic: 1.245 on 5 and 113 DF,  p-value: 0.2927
</pre>
<p>We used only 5 principle components as modeling variables, because as is typical of principle component analysis- beyond the first few components the components become vanishingly small and unsuitable to use in modeling (see graph pcomp below).</p>
<p><img src="http://www.win-vector.com/blog/wp-content/uploads/2009/12/pcomp.png" width="400"></p>
<p>However, this gave a model with far smaller R-squared than people are reporting, so lets add in a lot of components like everybody else does (bad!).</p>
<pre>
&gt; model &lt;- lm(avgTemp ~ PC1 + PC2 + PC3 + PC4 + PC5 + PC6 + PC7 + PC8 + PC9 +PC10 +PC11 +PC12 + PC13 ,dat=datUnion)
&gt; summary(model)

Call:
lm(formula = avgTemp ~ PC1 + PC2 + PC3 + PC4 + PC5 + PC6 + PC7 +
    PC8 + PC9 + PC10 + PC11 + PC12 + PC13, data = datUnion)

Residuals:
     Min       1Q   Median       3Q      Max
-0.87249 -0.25951  0.03996  0.25055  0.99039 

Coefficients:
              Estimate Std. Error t value Pr(&gt;|t|)
(Intercept)  7.431e-01  1.424e+00   0.522   0.6028
PC1         -1.796e-04  3.665e-04  -0.490   0.6253
PC2         -4.179e-04  9.759e-04  -0.428   0.6694
PC3          3.306e-05  1.430e-03   0.023   0.9816
PC4          3.416e-03  1.803e-03   1.894   0.0609 .
PC5          4.032e-02  1.978e-02   2.039   0.0440 *
PC6         -3.260e-03  2.660e-02  -0.123   0.9027
PC7         -7.134e-02  3.620e-02  -1.971   0.0514 .
PC8         -1.339e-01  7.895e-02  -1.696   0.0928 .
PC9          7.577e-02  5.734e-02   1.321   0.1892
PC10         2.700e-01  5.878e-02   4.594 1.22e-05 ***
PC11         8.562e-02  6.741e-02   1.270   0.2068
PC12        -8.057e-02  1.053e-01  -0.765   0.4461
PC13        -4.099e-02  1.064e-01  -0.385   0.7008
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 0.4141 on 105 degrees of freedom
  (484 observations deleted due to missingness)
Multiple R-squared: 0.2558,	Adjusted R-squared: 0.1637
F-statistic: 2.777 on 13 and 105 DF,  p-value: 0.001961
</pre>
<p>This is a degenerate model that essentially didn&#8217;t fit (thought the significance on PC10 component fools the fitter, but PC10 can&#8217;t be usable- it is essentially noise).  Graphically we can see the fit is not very useful (despite having  a little bit of R-squared) by looking at the graph of the fit plotted in the region of fitting.  Notice how the fit variance is much smaller than the true data variance even in the region of training data, this is typical of bad regression fits.</p>
<pre>
&gt; dRange &lt;- datUnion[datUnion$Year&gt;=1856 &#038; datUnion$Year&lt;=1980,]
&gt; xyplot(avgTemp + prediction ~Year,dat=dRange,type='l',auto.key=TRUE)
</pre>
<p><img src="http://www.win-vector.com/blog/wp-content/uploads/2009/12/pFitRegion.png" width="400"></p>
<p>Now the statement they wanted to make is that the present looks nothing like the past.  The past is only available through the fit model so what you would hope is that the model looks like the present and then the model itself separates the past and present.  Instead as you see in the graphs above and below this fails two ways: the model looks nothing like the present and the model&#8217;s past looks a lot like the model&#8217;s present.</p>
<pre>
&gt; datUnion$prediction &lt;- predict(model,newdata=datUnion)
&gt; xyplot(avgTemp + prediction ~Year,dat=datUnion,type=c('p','smooth'),auto.key=TRUE)
</pre>
<p><img src="http://www.win-vector.com/blog/wp-content/uploads/2009/12/pBoth.png" width="400"></p>
<p>What we could do to falsely drive the conclusion (which itself may or may not be true, it just is not supported by this technique, model or data) is create the infamous graph where we switch from modeled data in the past to actual data in the present and then act surprised that the two did not line up (which they did at no step during the fitting).  I don&#8217;t have the heart to unify the colors or remove the legend, but here is the graph below:</p>
<pre>
&gt; datUnion$dinked &lt;- datUnion$prediction
&gt; datUnion$dinked[!is.na(datUnion$avg)] &lt;- NA
&gt; xyplot(avgTemp + dinked ~Year,dat=datUnion,type=c('p','smooth'),auto.key=TRUE)
</pre>
<p><img src="http://www.win-vector.com/blog/wp-content/uploads/2009/12/pJacked.png" width="400"></p>
<p>The reason the blue points look different than the others is they came from the average temperature data instead of the model (where everything else came from).  Switching the series is essentially assuming the conclusion that recent past looks very different than the far past.</p>
<p>Essentially this methodology was so poor it could not have illustrated or contradicted recent global warming.  There are plenty of warning signs that the model fitting are problematic and the conclusion illustrated in the last graph can not actually be proved or disproved from this data (the proxy variables are too weak to be useful, that is not to say there are not other better proxy variables or modeling techniques).  The problems of the presentation are, of course, not essential problems in detecting global warming (which likely is occurring and likely will be a drain on future quality of life) but problems found in a single bad analysis.</p>


<p>Related posts:<ol><li><a href='http://www.win-vector.com/blog/2009/11/r-examine-objects-tutorial/' rel='bookmark' title='Permanent Link: R examine objects tutorial'>R examine objects tutorial</a></li>
<li><a href='http://www.win-vector.com/blog/2009/09/survive-r/' rel='bookmark' title='Permanent Link: Survive R'>Survive R</a></li>
<li><a href='http://www.win-vector.com/blog/2010/03/r-annoyances/' rel='bookmark' title='Permanent Link: R annoyances'>R annoyances</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.win-vector.com/blog/2009/12/cru-graph-yet-again-with-r/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A Demonstration of Data Mining</title>
		<link>http://www.win-vector.com/blog/2009/08/a-demonstration-of-data-mining/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=a-demonstration-of-data-mining</link>
		<comments>http://www.win-vector.com/blog/2009/08/a-demonstration-of-data-mining/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 01:16:27 +0000</pubDate>
		<dc:creator>John Mount</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Expository Writing]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Data Mining]]></category>
		<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[ML]]></category>
		<category><![CDATA[Regression]]></category>

		<guid isPermaLink="false">http://www.win-vector.com/blog/?p=252</guid>
		<description><![CDATA[REPOST (now in HTML in addition to the original PDF). This paper demonstrates and explains some of the basic techniques used in data mining. It also serves as an example of some of the kinds of analyses and projects Win Vector LLC engages in. August 19, 2009 John Mount1 A Demonstration of Data Mining 1&#160;&#160;Introduction [...]


Related posts:<ol><li><a href='http://www.win-vector.com/blog/2009/04/the-data-enrichment-method/' rel='bookmark' title='Permanent Link: The Data Enrichment Method'>The Data Enrichment Method</a></li>
<li><a href='http://www.win-vector.com/blog/2009/01/exciting-technique-1-the-r-language/' rel='bookmark' title='Permanent Link: Exciting Technique #1: The &#8220;R&#8221; language.'>Exciting Technique #1: The &#8220;R&#8221; language.</a></li>
<li><a href='http://www.win-vector.com/blog/2009/08/good-graphs-graphical-perception-and-data-visualization/' rel='bookmark' title='Permanent Link: Good Graphs: Graphical Perception and Data Visualization'>Good Graphs: Graphical Perception and Data Visualization</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>REPOST (now in HTML in addition to the original  <a href="http://www.win-vector.com/dfiles/ADemonstrationOfDataMining.pdf"> PDF</a>).</p>
<p>This paper  demonstrates and explains some of the basic techniques used in data mining.  It also serves as an example of some of the kinds of analyses and projects Win Vector LLC engages in.<span id="more-252"></span>
<div class="p"><!----></div>
<h3 align="center">August 19, 2009 </h3>
<h3 align="center">John Mount<a href="#tthFtNtAAB" name="tthFrefAAB"><sup>1</sup></a> </h3>
<h1 align="center">A Demonstration of Data Mining </h1>
<div class="p"><!----></div>
<h2><a name="tth_sEc1"><br />
1</a>&nbsp;&nbsp;Introduction</h2>
<div class="p"><!----></div>
<p> A major industry in our time is the collection of large data sets in preparation for the magic of data mining [<a href="#NYTStat" name="CITENYTStat">Loh09</a>,<a href="#Halevy:2009p2327" name="CITEHalevy:2009p2327">HNP09</a>].  There is extreme excitement about both the possible applications (identifying important customers, identifying medical risks, targeting advertising, designing auctions and so on) and the various methods for data mining and machine learning.  To some extent these methods are classic statistics presented in a new bottle.  Unfortunately, the concerns, background and language of the modern data-mining practitioner are different than that of the classic statistician- so some demonstration and translation is required.  In this writeup we will show how much of the magic of current data mining and machine learning can be explained in terms of statistical regression techniques and show how the statistician&#8217;s view is useful in choosing techniques.</p>
<div class="p"><!----></div>
<p> Too often data mining is used as a black-box. It is quite possible to clearly use statistics to understand the meaning and mechanisms of data mining.</p>
<div class="p"><!----></div>
<h2><a name="tth_sEc2"><br />
2</a>&nbsp;&nbsp;The Example Problem</h2>
<div class="p"><!----></div>
<p> Throughout this writeup we will work on a single idealized example problem.  For our problem we will assume we are working with a company that sells items and that this company has recorded its past sales visits.  We assume they recorded how well the prospect matched the product offering (we will call this &#8220;match factor&#8221;), how much of a discount was offered to the prospect (we will call this &#8220;discount factor&#8221;) and if the prospect became a customer or not (this is our determination of positive or negative outcome).  The goal is to use this past record as &#8220;training data&#8221; and build a model to predict the odds of making a new sale as a function of the match factor and the discount factor.  In a perfect world the historic data would look a lot like Figure&nbsp;<a href="#fig:IdealFitting">1</a>.  In Figure&nbsp;<a href="#fig:IdealFitting">1</a> each icon represents a past sales-visit, the red diamonds are non-sales and the green disks are successful sales.  Each icon is positioned horizontally to correspond to the discount factor used and vertically to correspond to the degree of product match estimated during the prospective customer visit.  This data is literally too good to be true in at least three qualities: the past data covers a large range of possibilities, every possible combination has already been tried in an orderly fashion and the good and bad events &#8220;are linearly separable.&#8221;  The job of the modeler would then be to draw the separating line (shown in Figure&nbsp;<a href="#fig:IdealFitting">1</a>) and label every situation above and to the right of the separating line as good (or positive) and every situation below and to the left as bad (or negative).</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg1"><br />
</a><br />
<center><img width="400" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/IdealFitting.png" alt="IdealFitting.png" /></p>
<p></center><center>Figure 1: Ideal Fitting Situation</center><br />
<a name="fig:IdealFitting"><br />
</a></p>
<div class="p"><!----></div>
<p> In reality past data is subject to what prospects were available (so you are unlikely to have good range and an orderly layout of past sales calls) and also heavily affected by past policy.  An example policy might be that potential customers with good product match factor may never have been offered a significant discount in the past; so we would have no data from that situation.  Finally each outcome is a unique event that depends on a lot more than the two quantities we are recording- so it is too much to hope that the good prospects are simply separable from the bad ones.</p>
<div class="p"><!----></div>
<p> Figure&nbsp;<a href="#fig:IdealFitting">1</a> is a mere cartoon or caricature of the modeling process, but it represents the initial intuition behind data mining.  Again: the flaws in Figure&nbsp;<a href="#fig:IdealFitting">1</a> represent the implicit hopes of the data miner.  The data miner wishes that the past experiments are laid out in an orderly manner, data covers most of the combinations of possibilities and there is a perfect and simple concept ready to be learned.</p>
<div class="p"><!----></div>
<p> Frankly, an experienced data miner would feel incredibly fortunate if the past data looked anything like what is shown in Figure&nbsp;<a href="#fig:EmpiricalData">2</a>.</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg2"><br />
</a><br />
<center><img width="400" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/empirical1.png" alt="empirical1.png" /></p>
<p></center><center>Figure 2: Empirical Data</center><br />
<a name="fig:EmpiricalData"><br />
</a></p>
<div class="p"><!----></div>
<p> The green disks (representing good past prospects) and the red diamonds (representing bad past prospects) are intermingled (which is bad).  There is some evidence that past policy was to lower the discount offered as the match factor increased (as seen in the diagonal spread of the green disks).  Finally we see the red diamonds are also distributed differently than the green disks. This is both good and bad.  The good is that the center of mass of the red diamonds differs from the center of mass of the green disks.  The bad is that the density of red diamonds does not fall any faster as it passes into the green disks than it falls in any other direction.  This indicates there is something important and different (and not measured in our two variables) about at least some of the bad prospects.  It is the data miner&#8217;s job be aware and to press on.</p>
<div class="p"><!----></div>
<h3><a name="tth_sEc2.1"><br />
2.1</a>&nbsp;&nbsp;The Trendy Now</h3>
<div class="p"><!----></div>
<p> In truth data miners often rush where classical statisticians fear to tread.  Right now the temptation is to immediately select from any number of &#8220;red hot&#8221; techniques, methods or software packages.  My short list of super-star method buzzwords includes:</p>
<div class="p"><!----></div>
<ul>
<li> Boosting[<a href="#Schapire:2001p1019" name="CITESchapire:2001p1019">Sch01</a>,<a href="#Breiman:2000p1134" name="CITEBreiman:2000p1134">Bre00</a>,<a href="#Freund:2003p1009" name="CITEFreund:2003p1009">FISS03</a>]
<div class="p"><!----></div>
</li>
<li> Latent Dirichlet Allocation[<a href="#Blei:2003p1063" name="CITEBlei:2003p1063">BNJ03</a>]
<div class="p"><!----></div>
</li>
<li> Linear Regression[<a href="#statistics" name="CITEstatistics">FPP07</a>,<a href="#Agresti" name="CITEAgresti">Agr02</a>]
<div class="p"><!----></div>
</li>
<li> Linear Discriminant Analysis[<a href="#Fisher:1936p2576" name="CITEFisher:1936p2576">Fis36</a>]
<div class="p"><!----></div>
</li>
<li> Logistic Regression[<a href="#Agresti" name="CITEAgresti">Agr02</a>,<a href="#Klein:2003p261" name="CITEKlein:2003p261">KM03</a>]
<div class="p"><!----></div>
</li>
<li> Kernel Methods[<a href="#kernel1" name="CITEkernel1">CST00</a>,<a href="#kernel2" name="CITEkernel2">STC04</a>]
<div class="p"><!----></div>
</li>
<li> Maximum Entropy[<a href="#Klein:2003p261" name="CITEKlein:2003p261">KM03</a>,<a href="#Grunwald:2005p108" name="CITEGrunwald:2005p108">Gru05</a>,<a href="#Stern:1989p1480" name="CITEStern:1989p1480">SC89</a>,<a href="#Dudik:2006p954" name="CITEDudik:2006p954">DS06</a>]
<div class="p"><!----></div>
</li>
<li> Naive Bayes[<a href="#Lewis:1998p105" name="CITELewis:1998p105">Lew98</a>]
<div class="p"><!----></div>
</li>
<li> Perceptrons[<a href="#Beigel:2008p1027" name="CITEBeigel:2008p1027">BRS08</a>,<a href="#Dasgupta:2005p2013" name="CITEDasgupta:2005p2013">DKM05</a>]
<div class="p"><!----></div>
</li>
<li> Quantile Regression[<a href="#quantile" name="CITEquantile">Koe05</a>]
<div class="p"><!----></div>
</li>
<li> Ridge Regression[<a href="#Breiman:1997p1133" name="CITEBreiman:1997p1133">BF97</a>]
<div class="p"><!----></div>
</li>
<li> Support Vector Machines[<a href="#kernel1" name="CITEkernel1">CST00</a>]
<div class="p"><!----></div>
</li>
</ul>
<div class="p"><!----></div>
<p> Based on some of the above referenced writing and analysis I would first pick &#8220;logistic regression&#8221; as I am confident that, when used properly, it is just about as powerful as any of the modern data mining techniques (despite its somewhat less than trendy status).  Using logistic regression I immediately get just about as close to a separating line as this data set will support: Figure&nbsp;<a href="#fig:LinearSepartor">3</a>.</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg3"><br />
</a><br />
<center><img width="400" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/lin1.png" alt="lin1.png" /></p>
<p></center><center>Figure 3: Linear Separator</center><br />
<a name="fig:LinearSepartor"><br />
</a></p>
<div class="p"><!----></div>
<p> The separating line actually encodes a simple rule of the form: &#8220;if 2.2*DiscountFactor + 3.1*MatchFactor &#8805; 1 then we have a good chance of a sale.&#8221;  This is classic black-box data mining magic.  The purpose of this writeup is to look deeper how to actually derive and understand something like this.</p>
<div class="p"><!----></div>
<h2><a name="tth_sEc3"><br />
3</a>&nbsp;&nbsp;Explanation</h2>
<div class="p"><!----></div>
<p> What is really going on?  Why is our magic formula at all sensible advice, why did this work at all and what motivates the analysis?  It turns out regression (be it linear regression or logistic regression) works in this case because it somewhat imitates the methodology of linear discriminant analysis (described in: [<a href="#Fisher:1936p2576" name="CITEFisher:1936p2576">Fis36</a>]).  In fact in many cases it would be a better idea to perform a linear discriminant analysis or perform an analysis of variance than to immediately appeal to a complicated method.  I will first step through the process of linear discriminant analysis and then relate it to our logistic regression.  Stepping through understandable stages lets us see where we were lucky in modeling and what limits and opportunities for improvement we have.</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg4"><br />
</a><br />
<center></p>
<table>
<tr>
<td><img width="250" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/posDat.png" alt="posDat.png" /></td>
<td><img width="250" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/negDat.png" alt="negDat.png" />
</td>
</tr>
</table>
<p></center><center>Figure 4: Separate Plots</center><br />
<a name="fig:SeparatePlots"><br />
</a></p>
<div class="p"><!----></div>
<p> Our data initially looks very messy (the good and bad group are fairly mixed together).  But if we examine out data in separate groups we can see we are actually incredibly lucky in that the data is easy to describe.  As we can see in Figure&nbsp;<a href="#fig:SeparatePlots">4</a>: the data, when separated by outcome (plotting only all of the good green disks or only all of the bad red diamonds), is grouped in simple blobs without bends, intrusions or other odd (and more work to model) configurations.</p>
<div class="p"><!----></div>
<p> We can plot the idealizations of these data distributions (or densities) as &#8220;contour maps&#8221; (as if we are looking down on the elevations of a mountain on a map) which gives us Figure&nbsp;<a href="#fig:SeparateDistributions">5</a>.</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg5"><br />
</a><br />
<center></p>
<table>
<tr>
<td><img width="250" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/posDist.png" alt="posDist.png" /></td>
<td> <img width="250" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/negDist.png" alt="negDist.png" />
</td>
</tr>
</table>
<p></center><center>Figure 5: Separate Distributions</center><br />
<a name="fig:SeparateDistributions"><br />
</a></p>
<div class="p"><!----></div>
<h3><a name="tth_sEc3.1"><br />
3.1</a>&nbsp;&nbsp;Full Bayes Model</h3>
<div class="p"><!----></div>
<p> From Figure&nbsp;<a href="#fig:SeparateDistributions">5</a> we can see while our data is not separable there are significant differences between the groups.  The difference in the groups is more obvious if we plot the difference of the densities on the same graph as in Figure&nbsp;<a href="#fig:DifferenceInDensity">6</a>.  Here we are visualizing the distribution of positive examples as a connected pair of peaks (colored green) and the distribution of negative examples a deep valley (colored red) located just below and to the left of the peaks.</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg6"><br />
</a><br />
<center><img width="400" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/diff1.png" alt="diff1.png" /></p>
<p></center><center>Figure 6: Difference in Density</center><br />
<a name="fig:DifferenceInDensity"><br />
</a></p>
<div class="p"><!----></div>
<p> This difference graph is demonstrating how both of the densities or distributions (positive and negative) reach into different regions of the plane.  The white areas are where the difference in densities is very small which includes the areas in the corners (where there is little of either distribution) and the area between the blobs (where there is a lot of mass from both distributions competing).  This view is a bit closer to what a statistician wants to see- how the distributions of successes and failures different (this is a step to take before even guessing at or looking for causes and explanations).</p>
<div class="p"><!----></div>
<p> Figure&nbsp;<a href="#fig:DifferenceInDensity">6</a> is already an actionable model- we can predict the odds a new prospect will buy or not at a given discount by looking where they fall on Figure&nbsp;<a href="#fig:DifferenceInDensity">6</a> and checking if they fall in a region on strong red or strong green color.  We can also recommend a discount for a given potential customer by drawing a line at the height determined by their degree of match and tracing from left to right until we first hit a strong green region.  We could hand out a simplified Figure&nbsp;<a href="#fig:FullBayesModel">7</a> as a sales rulebook.</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg7"><br />
</a><br />
<center><img width="400" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/bayesModel1.png" alt="bayesModel1.png" /></p>
<p></center><center>Figure 7: Full Bayes Model</center><br />
<a name="fig:FullBayesModel"><br />
</a></p>
<div class="p"><!----></div>
<p> This model is a full Bayes model (but not a Naive Bayes model, which is oddly more famous and which we will cover later).  The steps we took were: first we summarized or idealized our known data into two Gaussian blobs (as depicted in Figure&nbsp;<a href="#fig:SeparateDistributions">5</a>).  Once we had estimated the centers, widths and orientations of these blobs we could then: for any new point say how likely the point is under the modeled distribution of sales and how likely the point is under the modeled distribution of non-sales.  Mathematically we claim we can estimate P(x,y &#124;sale)<a href="#tthFtNtAAC" name="tthFrefAAC"><sup>2</sup></a> and P(x,y &#124; non-sale) (where x is our discount factor and y is our matching factor).<a href="#tthFtNtAAD" name="tthFrefAAD"><sup>3</sup></a> Neither of these are what we are actually interested in (we want: P(sale &#124; x,y)<a href="#tthFtNtAAE" name="tthFrefAAE"><sup>4</sup></a>).  We can, however, use these values to calculate what we want to know.  Bayes&#8217; law is a law of probability that says if we know P(sale &#124; x,y), P(non-sale &#124; x,y), P(sale) and P(non-sale)<a href="#tthFtNtAAF" name="tthFrefAAF"><sup>5</sup></a> then:</p>
<p><center><br />
<img src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/eqn1.png"/><br />
</center></p>
<p>Figure&nbsp;<a href="#fig:FullBayesModel">7</a> depicts a central hourglass shaped region (colored green) that represents the region of x, y values where P(sale &#124;x,y) is estimated to be at least 0.5 and the remaining (darker red region) are the situations predicted to be less favorable.  Here we are using priors of P(sale) = P(non-sale) = 0.5, for different priors and thresholds we would get different graphs.</p>
<div class="p"><!----></div>
<p> Even at this early stage in the analysis we have already accidentally introduced what we call &#8220;an inductive bias.&#8221;  By modeling both distributions as Gaussians we have guaranteed that our acceptance region will be an hourglass figure (as we saw in Figure&nbsp;<a href="#fig:FullBayesModel">7</a>).  One undesirable consequence of the modeling technique is the prediction sales become unlikely when both match factor and discount factor are very large.  This is somewhat a consequence of our modeling technique (though the fact that the negative data does not fall quickly as it passes into the green region also added to this).  This un-realistic (or &#8220;not physically plausible&#8221;) prediction is called an artifact (of the technique and of the data) and it is the statistician&#8217;s job to see this, confirm they don&#8217;t want it and eliminate it (by deliberately introducing a &#8220;useful modeling bias&#8221;).</p>
<div class="p"><!----></div>
<h3><a name="tth_sEc3.2"><br />
3.2</a>&nbsp;&nbsp;Linear Discriminant</h3>
<div class="p"><!----></div>
<p> To get around the bad predictions of our model in the upper-right quadrant we &#8220;apply domain knowledge&#8221; and introduce a useful modeling bias as follows.  Let us insist that our model be monotone: that if moving some direction is good than moving further in the same direction is better.  In fact let&#8217;s insist that our model be a half-plane (instead of two parabolas).  We want a nice straight separating cut, which brings us to linear discriminant analysis.  We have enough information to apply Fisher linear discriminant technique and find a separator that maximizes the variance of data across categories while minimizing the variance of data within one category and within the other category.  This is called the linear discriminant and it is shown in Figure&nbsp;<a href="#fig:LinearDiscriminant">8</a>.</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg8"><br />
</a><br />
<center><img width="400" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/lda1.png" alt="lda1.png" /></p>
<p></center><center>Figure 8: Linear Discriminant</center><br />
<a name="fig:LinearDiscriminant"><br />
</a></p>
<div class="p"><!----></div>
<p> The blue line is the linear discriminant (similar to the logistic regression line depicted earlier on the data-slide).  Everything above or to the right of the blue line is considered good and everything below or to the left of the blue line is considered bad.  Notice that this advice while not quite as accurate as the Bayes Model near the boundary between the two distributions is much more sensible about the upper right corner of the graph.</p>
<div class="p"><!----></div>
<p> To evaluate a separator we collapse all variation parallel to the separating cut (as shown in Figure&nbsp;<a href="#fig:collapse">9</a>).  We then see that each distribution becomes a small interval or streak.  A separator is good if these resulting streaks are both short (the collapse packs the blobs) and the two centers of the streaks are far apart (and on opposite size of the separator).  In Figure&nbsp;<a href="#fig:collapse">9</a> the streaks are fairly short and despite some overlap we do have some usable separation between the two centers.</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg9"><br />
</a><br />
<center><img width="400" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/collapse2.png" alt="collapse2.png" /></p>
<p></center><center>Figure 9: Evaluating Quality of Separating Cut</center><br />
<a name="fig:collapse"><br />
</a></p>
<div class="p"><!----></div>
<p> To make the above precise we switch to mathematical notation.  For the i-th positive training example form the vector v<sub>+,i</sub> and the matrix S<sub>+,i</sub> where</p>
<p><center><br />
<img src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/eqn2.png"/><br />
</center></p>
<div class="p"><!----></div>
<p> where x<sub>i</sub> and y<sub>i</sub> are the known x and y coordinates for this particular past experience.  Define v<sub>&#8722;,i</sub>, S<sub>&#8722;,i</sub> similarly for all negative examples.  In this notation we have for a direction &#947;: the distance along the &#947; direction between the center of positive examples and center of negative examples is: &#947;<sup>T</sup> ( &#8721;<sub>i</sub> v<sub>+,i</sub> / n<sub>+</sub> &#8722; &#8721;<sub>i</sub> v<sub>&#8722;,i</sub> / n<sub>&#8722;</sub>) (where n<sub>+</sub> is the number of positive examples and n<sub>&#8722;</sub> is the number of negative examples).  We would like this quantity to be large.  The degree of spread or variance of the positive examples along the &#947; direction is &#947;<sup>T</sup> (&#8721;<sub>i</sub> S<sub>+,i</sub> / n<sub>+</sub>) &#947;.  The degree of spread or variance of the negative examples along the &#947; direction is &#947;<sup>T</sup> (&#8721;<sub>i</sub> S<sub>&#8722;,i</sub> / n<sub>&#8722;</sub>) &#947;.  We would like the last two quantities to be small.  The linear discriminant is picked to maximize:</p>
<p><center><br />
<img src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/eqn3.png"/><br />
</center></p>
<p>It is a fairly standard observation (involving the Rayleigh quotient) that this form is maximized when:<br />
<center><br />
<a name="eq:lda"><br />
</a><br />
<img src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/eqn4.png"/><br />
</center></p>
<div class="p"><!----></div>
<p> As we have said, the linear discriminant is very similar to what is returned by a regression or logistic regression.  In fact in our diagrams the regression lines are almost identical to the linear discriminant.  A large part of why regression can be usefully applied in classification comes from its close relationship to the linear discriminant.</p>
<div class="p"><!----></div>
<h3><a name="tth_sEc3.3"><br />
3.3</a>&nbsp;&nbsp;Linear Regression</h3>
<div class="p"><!----></div>
<p> Linear regression is designed to model continuous functions subject to independent normal errors in observation.  Linear regression is incredibly powerful at characterizing and elimination correlations between the input variables of a model.  While function fitting is different than classification (our example problem) linear regression is so useful whenever there is any suspected correlation (which is almost always the case) that it is an appropriate tool.  In our example in the positive examples (those that led to sales) there is clearly a historical dependence between the degree of estimated match and amount of discount offered.  Likely this dependence is from past prospects being subject to a (rational) policy of &#8220;the worse the match the higher the offered discount&#8221; (instead of being arranged in a perfect grid-like experiment as in our first diagram: Figure&nbsp;<a href="#fig:IdealFitting">1</a>).  If this dependence is not dealt with we would under-estimate the value of discount because we would think that discounted customers are not signing up at a higher rate (when these prospects are in fact clearly motivated by discount, once you control for the fact that many of the deeply discounted prospects had a much worse degree of match than average).</p>
<div class="p"><!----></div>
<p> For analysis of categorical data linear regression is closely linked to ANOVA (analysis of variance).[<a href="#Agresti" name="CITEAgresti">Agr02</a>] Recall that variance was a major consideration with the linear discriminant analysis, so we should by now be on familiar ground.</p>
<div class="p"><!----></div>
<p>In our notation the standard least-squares regression solution is:<br />
<center><br />
<a name="eq:leastsquares"><br />
</a><br />
<img src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/eqn5.png"/><br />
</center></p>
<p>where y<sub>+,i</sub> = 1 for all i and y<sub>&#8722;,i</sub> = &#8722;1 for all i.</p>
<div class="p"><!----></div>
<p> If we have the same number of positive and negative examples (i.e.  n<sub>+</sub> = n<sub>&#8722;</sub>) then Equation&nbsp;<a href="#eq:lda">1</a> and Equation&nbsp;<a href="#eq:leastsquares">2</a> are identical and we have &#946; = &#947;.  So in this special case the linear discriminant equals the least square linear regression solution.  We can even ask how the solutions change if the relative proportions of positive and negative training data changes.  The linear discriminant is carefully designed not to move, but the regression solution will tilt to be an angle that is more compatible with the larger of the example classes and shift to cut less into that class.  The linear regression solution can be fixed (by re-weighting the data) to also be insensitive to the relative proportions of positive and negative examples but does not behave that way &#8220;fresh out of the box.&#8221;</p>
<div class="p"><!----></div>
<h3><a name="tth_sEc3.4"><br />
3.4</a>&nbsp;&nbsp;Logistic Regression</h3>
<div class="p"><!----></div>
<p> While linear regression is designed to pick a function that minimizes the sum of square errors logistic regression is designed to pick a separator that maximizes something called <em>the plausibility of the data</em>.  In our case since the data is so well behaved the logistic regression line is essentially the same as the linear regression line.  It is in fact an important property of logistic regression that there is always a re-weighting (or choice of re-emphasis) of the data that causes some linear regression to pick the same separator as the logistic regression.  Because linear and logistic regression are only identical in specific circumstances it is the job of the statistician to know which of the two is more appropriate for a given data set and given intended use of the resulting model.</p>
<div class="p"><!----></div>
<h2><a name="tth_sEc4"><br />
4</a>&nbsp;&nbsp;Other Methods and Techniques</h2>
<div class="p"><!----></div>
<h3><a name="tth_sEc4.1"><br />
4.1</a>&nbsp;&nbsp;Kernelized Regression</h3>
<div class="p"><!----></div>
<p> One way to greatly expand the power of modeling methods is a trick called kernel methods.  Roughly kernel methods are those methods that increase the power of machine learning by moving from a simple problem space (like ours in variables x and y) to a richer problem space that may be easier to work in.  A lot of ink is spilled about how efficient the kernel methods are (they work in time proportional to the size of the simple space, not the complex one) but this is not their essential feature.  The essential feature is the expanded explanation power and this is so important that even the trivial kernel methods (such as directly adjoining additional combinations of variables) pick up most of the power of the method.  Kernel methods are also overly associated with Support Vector Machines- but are just as useful when added to Naive Bayes, linear regression or logistic regression.</p>
<div class="p"><!----></div>
<p> For instance: Figure&nbsp;<a href="#fig:KernelizedRegression">10</a> shows a bow-tie like acceptance region found by using linear regression over the variables x, y, x<sup>2</sup>, y<sup>2</sup> and x y (instead of just x and y).  Note how this result is similar to the full Bayes model (but comes from a different feature set and fitting technique).</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg10"><br />
</a><br />
<center><img width="400" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/kRegression.png" alt="kRegression.png" /></p>
<p></center><center>Figure 10: Kernelized Regression</center><br />
<a name="fig:KernelizedRegression"><br />
</a></p>
<div class="p"><!----></div>
<h3><a name="tth_sEc4.2"><br />
4.2</a>&nbsp;&nbsp;Naive Bayes Model</h3>
<div class="p"><!----></div>
<p> We briefly return to the Bayes model to discuss a more common alternative called &#8220;Naive Bayes.&#8221;  A Naive Bayes model is like a full Bayes model except an additional modeling simplification is introduced in assuming that P(x,y&#124;sale) = P(x&#124;sale)P(y&#124;sale) and P(x,y&#124;non-sale) = P(x&#124;non-sale)P(y&#124;non-sale).  That is we are assuming that the distributions of the x and y measurements are essentially independent (once we know which outcome happened).  This assumption is the opposite of what we do with regression in that we ignore dependencies in the data (instead of modeling and eliminating the dependencies).  However, Naive Bayes methods are quite powerful and very appropriate in sparse-data situations (such as text classification).  The &#8220;naive&#8221; assumption that the input variables are independent greatly reduces the amount of data that needs to be tracked (it is much less work to track values of variables instead of simultaneous values of pairs of variables).  The curved separator from this Naive Bayes model is illustrated in Figure&nbsp;<a href="#fig:NaiveBayesModel">11</a>.</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg11"><br />
</a><br />
<center><img width="400" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/naiveBayesModel1.png" alt="naiveBayesModel1.png" /></p>
<p></center><center>Figure 11: Naive Bayes Model</center><br />
<a name="fig:NaiveBayesModel"><br />
</a></p>
<div class="p"><!----></div>
<p> The Naive Bayes version of the advice or policy chart is always going to be an axis-aligned parabola as in Figure&nbsp;<a href="#fig:NaiveBayesDecision">12</a>.  Notice how both the linear discriminant and the Naive Bayes model make mistakes (places some colors on the wrong side of the curve)- but they are simple, reliable models that have the desirable property of having connected prediction regions.</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<p><a name="tth_fIg12"><br />
</a><br />
<center><img width="400" src="http://www.win-vector.com/blog/wp-content/uploads/2009/08/naiveBayesModel2.png" alt="naiveBayesModel2.png" /></p>
<p></center><center>Figure 12: Naive Bayes Decision</center><br />
<a name="fig:NaiveBayesDecision"><br />
</a></p>
<div class="p"><!----></div>
<h3><a name="tth_sEc4.3"><br />
4.3</a>&nbsp;&nbsp;More Exotic Methods</h3>
<div class="p"><!----></div>
<p> Many of the hot buzzword machine learning and data mining methods we listed earlier are essentially different techniques of fitting a linear separator over data.  These methods seem very different but they all form a family once you realize many of the details of the methods are determined by:</p>
<div class="p"><!----></div>
<ul>
<li> Choice of Loss Function
<div class="p"><!----></div>
<p> This is what notion of &#8220;goodness of fit&#8221; is being used.  It can be normalized mean-variance (linear discriminants), un-normalized variance (linear regression), plausibility (logistic regression), L1 distance (support vector machines, quantile regression), entropy (maximum entropy), probability mass and so on.</p>
<div class="p"><!----></div>
</li>
<li> Choice of Optimization Technique
<div class="p"><!----></div>
<p> For a given loss function we can optimize in many ways (though most authors make the mistake of binding their current favorite optimization method deep into their specification of technique): EM, steepest descent, conjugate gradient, quasi-Newton, linear programming and quadratic programming to name a few.</p>
<div class="p"><!----></div>
</li>
<li> Choice of Regularization Method
<div class="p"><!----></div>
<p> Regularization is the idea of forcing the model to not pick extreme values of parameters to over-fit irrelevant artifacts in training data.  Methods include MDL, controlling energy/entropy, Lagrange smoothing, shrinkage, bagging and early termination of optimization.  Non-explicit treatment of regularization is one reason many methods completely specify their optimization procedure (to get some accidental regularization).</p>
<div class="p"><!----></div>
</li>
<li> Choice of Features/Kernelization
<div class="p"><!----></div>
<p> The richness of the feature set the method is applied to is the single largest determinant of model quality.</p>
<div class="p"><!----></div>
</li>
<li> Pre-transformation Tricks
<div class="p"><!----></div>
<p> Some statistical methods are improved by pre-transforming the outcome data to look more normal or be more homoscedastic.<a href="#tthFtNtAAG" name="tthFrefAAG"><sup>6</sup></a></p>
<div class="p"><!----></div>
</li>
</ul>
<div class="p"><!----></div>
<p> If you think along a few axes like these (instead of evaluating them by their name and lineage) you tend to see different data mining methods more as embodying different trade-offs than as being unique incompatible disciplines.</p>
<div class="p"><!----></div>
<div class="p"><!----></div>
<h2><a name="tth_sEc5"><br />
5</a>&nbsp;&nbsp;Conclusion</h2>
<div class="p"><!----></div>
<p> Our goal for this writeup was to fully demonstrate a data mining method and then survey some important data mining and machine learning techniques.  Many of the important considerations are &#8220;too obvious&#8221; to be discussed by statisticians and &#8220;too statistical&#8221; to be comfortably expressed in terms popular with data miners.  The theory and considerations from statistics when combined with the experience and optimism of data-mining/machine-learning truly make possible achieving the important goal of &#8220;learning from data.&#8221;</p>
<div class="p"><!----></div>
<p>This expository writeup is also meant to serve as an example of the<br />
types of research, analysis, software and training supplied by<br />
Win-Vector LLC <a href="http://www.win-vector.com"><tt>http://www.win-vector.com</tt></a> .  Win-Vector LLC<br />
prides itself in depth of research and specializes in identifying,<br />
documenting and implementing the &#8220;simplest technique that can<br />
possibly work&#8221; (which is often the most understandable, maintainable,<br />
robust and reliable).  Win-Vector LLC specializes in research but<br />
has significant experience in delivering full solutions (including<br />
software solutions and integration with existing databases).</p>
<div class="p"><!----></div>
<p><font size="-1"></p>
<h2>References</h2>
<dl compact="compact">
<dt><a href="#CITEAgresti" name="Agresti">[Agr02]</a></dt>
<dd>
Alan Agresti, <em>Categorical data analysis (wiley series in probability and<br />
  statistics)</em>, Wiley-Interscience, July 2002.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEBreiman:1997p1133" name="Breiman:1997p1133">[BF97]</a></dt>
<dd>
Leo Breiman and Jerome&nbsp;H Friedman, <em>Predicting multivariate responses in<br />
  multiple linear regression</em>, Journal of the Royal Statistical Society, Series<br />
  B (Methodological) <b>59</b> (1997), no.&nbsp;1, 3-54.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEBlei:2003p1063" name="Blei:2003p1063">[BNJ03]</a></dt>
<dd>
David&nbsp;M Blei, Andrew&nbsp;Y Ng, and Michael&nbsp;I Jordan, <em>Latent dirichlet<br />
  allocation</em>, Journal of Machine Learning Research <b>3</b> (2003),<br />
  993-1022.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEBreiman:2000p1134" name="Breiman:2000p1134">[Bre00]</a></dt>
<dd>
Leo Breiman, <em>Special invited paper. additive logistic regression: A<br />
  statistical view of boosting: Discussion</em>, Ann. Statist. <b>28</b> (2000),<br />
  no.&nbsp;2, 374-377.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEBeigel:2008p1027" name="Beigel:2008p1027">[BRS08]</a></dt>
<dd>
Richard Beigel, Nick Reingold, and Daniel&nbsp;A Spielman, <em>The perceptron<br />
  strikes back</em>, 6.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEkernel1" name="kernel1">[CST00]</a></dt>
<dd>
Nello Cristianini and John Shawe-Taylor, <em>An introduction to support<br />
  vector machines and other kernel-based learning methods</em>, 1 ed., Cambridge<br />
  University Press, March 2000.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEDasgupta:2005p2013" name="Dasgupta:2005p2013">[DKM05]</a></dt>
<dd>
Sanjoy Dasgupta, Adam&nbsp;Tauman Kalai, and Claire Monteleoni, <em>Analysis of<br />
  perceptron-based active learning</em>, CSAIL Tech. Report (2005), 16.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEDudik:2006p954" name="Dudik:2006p954">[DS06]</a></dt>
<dd>
Miroslav Dudik and Robert&nbsp;E Schapire, <em>Maximum entropy distribution<br />
  estimation with generalized regularization</em>, COLT (2006), 15.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEFisher:1936p2576" name="Fisher:1936p2576">[Fis36]</a></dt>
<dd>
Ronald&nbsp;A Fisher, <em>The use of multiple measurements in taxonomic problems</em>,<br />
  Annals of Eugenics <b>7</b> (1936), 179-188.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEFreund:2003p1009" name="Freund:2003p1009">[FISS03]</a></dt>
<dd>
Yoav Freund, Raj Iyer, Robert&nbsp;E Schapire, and Yoram Singer, <em>An efficient<br />
  boosting algorithm for combining preferences</em>, Journal of Machine Learning<br />
  Research <b>4</b> (2003), 933-969.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEstatistics" name="statistics">[FPP07]</a></dt>
<dd>
David Freedman, Robert Pisani, and Roger Purves, <em>Statistics 4th edition</em>,<br />
  W. W. Norton and Company, 2007.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEGrunwald:2005p108" name="Grunwald:2005p108">[Gru05]</a></dt>
<dd>
Peter&nbsp;D Grunwald, <em>Maximum entropy and the glasses you are looking<br />
  through</em>.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEHalevy:2009p2327" name="Halevy:2009p2327">[HNP09]</a></dt>
<dd>
Alon Halevy, Peter Norvig, and Fernando Pereira, <em>The unreasonable<br />
  effectiveness of data</em>, IEEE Intellegent Systems (2009).</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEKlein:2003p261" name="Klein:2003p261">[KM03]</a></dt>
<dd>
Dan Klein and Christopher&nbsp;D Manning, <em>Maxent models, conditional<br />
  estimation, and optimization</em>.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEquantile" name="quantile">[Koe05]</a></dt>
<dd>
Roger Koenker, <em>Quantile regression</em>, Cambridge University Press, May<br />
  2005.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITELewis:1998p105" name="Lewis:1998p105">[Lew98]</a></dt>
<dd>
David&nbsp;D Lewis, <em>Naive (bayes) at forty: The independence assumption in<br />
  information retrieval</em>.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITENYTStat" name="NYTStat">[Loh09]</a></dt>
<dd>
Steve Lohr, <em>For today’s graduate, just one word: Statistics</em>,<br />
  <a href="http://www.nytimes.com/2009/08/06/technology/06stats.html"><tt>http://www.nytimes.com/2009/08/06/technology/06stats.html</tt></a>, August 2009.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITER:Sarkar:2008" name="R:Sarkar:2008">[Sar08]</a></dt>
<dd>
Deepayan Sarkar, <em>Lattice: Multivariate data visualization with R</em>,<br />
  Springer, New York, 2008, ISBN 978-0-387-75968-5.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEStern:1989p1480" name="Stern:1989p1480">[SC89]</a></dt>
<dd>
Hal Stern and Thomas&nbsp;M Cover, <em>Maximum entropy and the lottery</em>, Journal<br />
  of the American Statistical Association <b>84</b> (1989), no.&nbsp;408,<br />
  980-985.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITESchapire:2001p1019" name="Schapire:2001p1019">[Sch01]</a></dt>
<dd>
Robert&nbsp;E Schapire, <em>The boosting approach to machine learning an<br />
  overview</em>, 23.</p>
<div class="p"><!----></div>
</dd>
<dt><a href="#CITEkernel2" name="kernel2">[STC04]</a></dt>
<dd>
John Shawe-Taylor and Nello Cristianini, <em>Kernel methods for pattern<br />
  analysis</em>, Cambridge University Press, June 2004.</dd>
</dl>
<p></font></p>
<div class="p"><!----></div>
<p><center><b>APPENDIX</b><br />
</center></p>
<div class="p"><!----></div>
<h2><a name="tth_sEcA"><br />
A</a>&nbsp;&nbsp;Graphs</h2>
<div class="p"><!----></div>
<p>The majority of the graphs in this writeup were produced using &#8220;R&#8221;<br />
<a href="http://www.r-project.org/"><tt>http://www.r-project.org/</tt></a> and Deepayan Sarkar&#8217;s Lattice<br />
package[<a href="#R:Sarkar:2008" name="CITER:Sarkar:2008">Sar08</a>].</p>
<div class="p"><!----></div>
<hr />
<h3>Footnotes:</h3>
<div class="p"><!----></div>
<p><a name="tthFtNtAAB"></a><a href="#tthFrefAAB"><sup>1</sup></a><br />
<a href="mailto:jmount@win-vector.com"><tt>mailto:jmount@win-vector.com</tt></a><br />
<a href="http://www.win-vector.com/"><tt>http://www.win-vector.com/</tt></a><br />
<a href="http://www.win-vector.com/blog/"><tt>http://www.win-vector.com/blog/</tt></a></p>
<div class="p"><!----></div>
<p><a name="tthFtNtAAC"></a><a href="#tthFrefAAC"><sup>2</sup></a>Read P(A &#124; B) as: &#8220;the probability of A will<br />
  happen given we know B is true.&#8221;</p>
<div class="p"><!----></div>
<p><a name="tthFtNtAAD"></a><a href="#tthFrefAAD"><sup>3</sup></a>Technically we are working with densities, not<br />
  probabilities, but we will use probability notation for its<br />
  intuition.</p>
<div class="p"><!----></div>
<p><a name="tthFtNtAAE"></a><a href="#tthFrefAAE"><sup>4</sup></a>P(sale &#124; x,y) is the probability of<br />
making a sale as a function of what we know about the prospective<br />
customer and our offer.  Whereas P(x,y&#124;sale) was just how likely it is<br />
to see a prospect with the given x and y values, conditioned on knowing we made<br />
a sale to this prospect.</p>
<div class="p"><!----></div>
<p><a name="tthFtNtAAF"></a><a href="#tthFrefAAF"><sup>5</sup></a> P(sale) and<br />
  P(non-sale) are just the &#8220;prior odds&#8221; of sales or what<br />
  our estimate of our chances of success are before we look at any<br />
  facts about a particular customer.  We can use our historical<br />
  overall success and failure rates as estimates of these quantities.</p>
<div class="p"><!----></div>
<p><a name="tthFtNtAAG"></a><a href="#tthFrefAAG"><sup>6</sup></a>A situation is homoscedastic if the errors are independent of where we are in the parameter space (our x,y or match factor and discount factor).  This property is very important for meaningful fitting/modeling and interpreting significance of fits.</p>
<hr /><small>File translated from<br />
T<sub><font size="-1">E</font></sub>X<br />
by <a href="http://hutchinson.belmont.ma.us/tth/"><br />
T<sub><font size="-1">T</font></sub>H</a>,<br />
version 3.85.<br />On 29 Aug 2009, 11:43.</small></p>


<p>Related posts:<ol><li><a href='http://www.win-vector.com/blog/2009/04/the-data-enrichment-method/' rel='bookmark' title='Permanent Link: The Data Enrichment Method'>The Data Enrichment Method</a></li>
<li><a href='http://www.win-vector.com/blog/2009/01/exciting-technique-1-the-r-language/' rel='bookmark' title='Permanent Link: Exciting Technique #1: The &#8220;R&#8221; language.'>Exciting Technique #1: The &#8220;R&#8221; language.</a></li>
<li><a href='http://www.win-vector.com/blog/2009/08/good-graphs-graphical-perception-and-data-visualization/' rel='bookmark' title='Permanent Link: Good Graphs: Graphical Perception and Data Visualization'>Good Graphs: Graphical Perception and Data Visualization</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.win-vector.com/blog/2009/08/a-demonstration-of-data-mining/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
