<?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>Jared Lander</title>
	<atom:link href="http://www.jaredlander.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jaredlander.com</link>
	<description></description>
	<lastBuildDate>Fri, 30 Mar 2012 23:10:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Lotto Odds</title>
		<link>http://www.jaredlander.com/2012/03/lotto-odds/</link>
		<comments>http://www.jaredlander.com/2012/03/lotto-odds/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 23:01:01 +0000</pubDate>
		<dc:creator>Jared</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[ggplot]]></category>
		<category><![CDATA[Probability]]></category>
		<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://www.jaredlander.com/?p=828</guid>
		<description><![CDATA[With tonight&#8217;s Mega Millions jackpot estimated to be over $640 million there are long lines of people waiting to buy tickets.  Of course you always hear about the probability of winning which is easy enough to calculate:  Five numbers ranging from 1 through 56 are drawn (without replacement) then a sixth ball is pulled from ]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignnone" style="width: 500px"><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/03/lottery-dist.png"><img class=" " title="lottery dist" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/03/lottery-dist.png" alt="" width="490" height="347" /></a>
<p class="wp-caption-text">Distribution of Lottery Winners based on 1,000 Simulations</p>
</div>
<p>With tonight&#8217;s <a href="http://www.megamillions.com/">Mega Millions</a> jackpot estimated to be over $640 million there are long lines of people waiting to buy tickets.  Of course you always hear about the <a href="http://www.jaredlander.com/tag/probability/">probability</a> of winning which is easy enough to calculate:  Five numbers ranging from 1 through 56 are drawn (without replacement) then a sixth ball is pulled from a set of 1 through 46.  That means there are choose(56, 5) * 46 = 175,711,536 possible different combinations.  That is why people are constantly reminded of how unlikely they are to win.</p>
<p>But I want to see how likely it is that SOMEONE will win tonight.  So let&#8217;s break out <a href="http://www.jaredlander.com/tag/r/">R</a> and <a href="http://www.jaredlander.com/tag/ggplot">ggplot</a>!</p>
<p>As of this afternoon it was reported (sorry no source) that two tickets were sold for every American.  So let&#8217;s assume that each of these tickets is an independent Bernoulli trial with probability of success of 1/175,711,536.</p>
<p>Running 1,000 simulations we see the distribution of the number of winners in the histogram above.</p>
<p><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/03/lottery-dist.png"></a>So we shouldn&#8217;t be surprised if there are multiple winners tonight.</p>
<p>The R code:</p>
<pre>winners &lt;- rbinom(n=1000, size=600000000, prob=1/175000000)
qplot(winners, geom="histogram", binwidth=1, xlab="Number of Winners")</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredlander.com/2012/03/lotto-odds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pi Cake 2012</title>
		<link>http://www.jaredlander.com/2012/03/pi-cake-2012/</link>
		<comments>http://www.jaredlander.com/2012/03/pi-cake-2012/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 15:23:49 +0000</pubDate>
		<dc:creator>Jared</dc:creator>
				<category><![CDATA[Food]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Albert]]></category>
		<category><![CDATA[Chrissie Cook]]></category>
		<category><![CDATA[NYC Data Mafia]]></category>
		<category><![CDATA[Pi]]></category>
		<category><![CDATA[Pi Cake]]></category>
		<category><![CDATA[Pi Day]]></category>

		<guid isPermaLink="false">http://www.jaredlander.com/?p=814</guid>
		<description><![CDATA[This year&#8217;s Pi Cake courtesy of Chrissie Cook:

Side View:

And don&#8217;t forget this is Albert Einstein&#8217;s birthday was well.
How are you celebrating this fantastic geek holiday?
Like last year, the NYC Data Mafia will be out celebrating with (round) pizza.
]]></description>
			<content:encoded><![CDATA[<p>This year&#8217;s <a href="http://www.jaredlander.com/tag/pi-cake/">Pi Cake</a> courtesy of <a href="https://www.facebook.com/ChrissieCookCakes">Chrissie Cook</a>:</p>
<p><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/03/Pi-Cake-2012.jpg"><img class="aligncenter size-full wp-image-815" title="Pi Cake 2012" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/03/Pi-Cake-2012.jpg" alt="" width="478" height="640" /></a></p>
<p style="text-align: center;">Side View:</p>
<p style="text-align: center;"><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/03/Pi-Cake-2012-2.jpg"><img class="aligncenter size-full wp-image-817" title="Pi Cake 2012 2" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/03/Pi-Cake-2012-2.jpg" alt="" width="461" height="344" /></a></p>
<p style="text-align: left;">And don&#8217;t forget this is <a href="http://hazelwood.patch.com/articles/celebrate-albert-einstein-s-birthday-and-pi-day">Albert Einstein&#8217;s</a> birthday was well.</p>
<p style="text-align: left;">How are you celebrating this fantastic <a href="http://piday.org">geek holiday</a>?</p>
<p style="text-align: left;">Like <a href="http://www.jaredlander.com/2011/03/pi-day-photos/">last year</a>, the <a href="http://www.jaredlander.com/2010/12/nyc-data-mafia-t-shirts/">NYC Data Mafia</a> will be out celebrating with (round) <a href="http://www.jaredlander.com/tag/pizza/">pizza</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredlander.com/2012/03/pi-cake-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another Kind of Super Bowl Pool</title>
		<link>http://www.jaredlander.com/2012/02/another-kind-of-super-bowl-pool/</link>
		<comments>http://www.jaredlander.com/2012/02/another-kind-of-super-bowl-pool/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 22:02:02 +0000</pubDate>
		<dc:creator>Jared</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[New York]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Probability]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Sports]]></category>

		<guid isPermaLink="false">http://www.jaredlander.com/?p=791</guid>
		<description><![CDATA[
Shortly after the Giants fantastic defeat of the Patriots in Super Bowl XLVI (I was a little disappointed that Eli, Coughlin and the Vince Lombardi Trophy all got off the parade route early and the views of City Hall were obstructed by construction trailers, but Steve Weatherford was awesome as always) a friend asked me ]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/02/Giants-Parade.jpg"><img class="aligncenter size-full wp-image-799" title="Giants Parade" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/02/Giants-Parade.jpg" alt="" width="480" height="360" /></a></p>
<p>Shortly after the <a href="http://www.giants.com/">Giants</a> <a href="http://www.myfoxny.com/dpp/news/new-york-giants-super-bowl-victory-parade-2012">fantastic</a> <a href="http://pleasantville.patch.com/articles/photos-big-blue-fan-demonium-at-giants-parade#photo-9061098">defeat</a> of the <a href="http://twitpic.com/8gox3t">Patriots</a> in <a href="http://www.jaredlander.com/2012/02/football-score-distributions/">Super Bowl XLVI</a> (I was a little disappointed that Eli, Coughlin and the Vince Lombardi Trophy all got off the parade route early and the views of City Hall were obstructed by construction trailers, but Steve Weatherford was <a href="http://www.sportsgrid.com/nfl/steve-weatherford-giants-parade/">awesome</a> as always) a friend asked me to settle a debate amongst some people in a Super Bowl pool.</p>
<p>He writes:</p>
<blockquote><p>We have 10 participants in a superbowl pool.  The pool is a “pick the player who scores first” type pool.  In a hat, there are 10 Giants players.  Each participant picks 1 player out of the hat (in no particular order) until the hat is emptied.  Then 10 Patriots players go in the hat and each participant picks again.</p>
<p>In the end, each of the 10 participants has 1 Giants player and 1 Patriots player.  No one has any duplicate players as 10 different players from each team were selected.  Pool looks as follows:</p></blockquote>
<table>
<tbody>
<tr>
<td>Participant 1</td>
<td>Giant A</td>
<td>Patriot Q</td>
</tr>
<tr>
<td>Participant 2</td>
<td>Giant B</td>
<td>Patriot R</td>
</tr>
<tr>
<td>Participant 3</td>
<td>Giant C</td>
<td>Patriot S</td>
</tr>
<tr>
<td>Participant 4</td>
<td>Giant D</td>
<td>Patriot T</td>
</tr>
<tr>
<td>Participant 5</td>
<td>Giant E</td>
<td>Patriot U</td>
</tr>
<tr>
<td>Participant 6</td>
<td>Giant F</td>
<td>Patriot V</td>
</tr>
<tr>
<td>Participant 7</td>
<td>Giant G</td>
<td>Patriot W</td>
</tr>
<tr>
<td>Participant 8</td>
<td>Giant H</td>
<td>Patriot X</td>
</tr>
<tr>
<td>Participant 9</td>
<td>Giant I</td>
<td>Patriot Y</td>
</tr>
<tr>
<td>Participant 10</td>
<td>Giant J</td>
<td>Patriot Z</td>
</tr>
</tbody>
</table>
<blockquote><p>Winners = First Player to score wins half the pot.  First player to score in 2nd half wins the remaining half of the pot.</p>
<p>The question is, what are the odds that someone wins <strong>Both </strong>the 1st and 2nd half.  Remember, the picks were random.</p></blockquote>
<p>Before anyone asks about the <a href="http://content.usatoday.com/communities/gameon/post/2012/02/tom-bradys-super-bowl-safety-paid-50000-for-gambler/1">safety</a>, one of the slots was for Special Teams/Defense.</p>
<p>There are two <a href="http://www.jaredlander.com/tag/probability/">probabilistic</a> ways of thinking about this.  Both hinge on the fact that whoever scores first in each half is both independent and not mutually exclusive.</p>
<p>First, let&#8217;s look at the two halves individually.  In a given half any of 20 players can score first (10 from the Giants and 10 from the Patriots) and an individual participant can win with two of those.  So a participant has a 2/20 = 1/10 chance of winning a half.  Thus that participant has a (1/10) * (1/10) = 1/100 chance of winning both halves.  Since there are 10 participants there is an overall probability of 10 * (1/100) = 1/10 of any single participant winning both halves.</p>
<p>The other way is to think a little more combinatorically.  There are 20 * 20 = 400 different combinations of players scoring first in each half.  A participant has two players which are each valid for each half giving them four of the possible combinations leading to a 4 / 400 = 1/100 probability that a single participant will win both halves.  Again, there are 10 participants giving an overall 10% chance of any one participant winning both halves.</p>
<p>Since both methods agreed I am pretty confidant in the results, but just in case I ran some simulations in <a href="http://www.jaredlander.com/tag/r/">R</a> which you can find after the break.</p>
<p><span id="more-791"></span>For the simulation I built a function that randomly assigned a player from the Giants and a player from the Patriots to each participant, then randomly chose&#8211;from those 20 players&#8211;someone to score first and someone to score second, allowing the two to be the same.  If the two scorers belonged to the same participant the function returned 1, otherwise 0.  The code is below.</p>
<pre>runGame &lt;- function(participants, pick1, pick2)
{
    # build data.frame assigning a random selection from each team to each player
    choices &lt;- data.frame(Participants=participants, Pick1=sample(x=pick1, size=length(pick1), replace=FALSE), Pick2=sample(x=pick2, size=length(pick2), replace=FALSE))
    # randomly pick a player to score first
    firstScore &lt;- sample(c(pick1, pick2), 1)
    # randomly pick a player to score second
    secondScore &lt;- sample(c(pick1, pick2), 1)
    # see if the players who scored were both "owned" by the same participant
    if(max(which(choices$Pick1 == firstScore), which(choices$Pick2 == firstScore)) == max(which(choices$Pick1 == secondScore), which(choices$Pick2 == secondScore)))
    {
        return(1)
    }else
    {
        return(0)
    }
}</pre>
<p>A second function run the simulation however many times are desired.</p>
<pre>runSim &lt;- function(participants, pick1, pick2, n=10000)
{
    # number of simulations
    # hold the results
    results &lt;- rep(NA, n)

    for(i in 1:n)
    {
        results[i] &lt;- runGame(participants=participants, pick1=pick1, pick2=pick2)
    }
    # find percentage
    return(results)
}</pre>
<p>Running this simulation 10,000 times, I found that the average rate for the same participant to win both parts of the pool was .1041 with a standard error of .003.</p>
<p>So, the simulations confirm the probability theory that about 10% of the time the same participant will both sections of the pool, pissing off all of his friends.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredlander.com/2012/02/another-kind-of-super-bowl-pool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Football Score Distributions</title>
		<link>http://www.jaredlander.com/2012/02/football-score-distributions/</link>
		<comments>http://www.jaredlander.com/2012/02/football-score-distributions/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 05:54:16 +0000</pubDate>
		<dc:creator>Jared</dc:creator>
				<category><![CDATA[New York]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Football]]></category>
		<category><![CDATA[ggplot]]></category>
		<category><![CDATA[Probability]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Sports]]></category>

		<guid isPermaLink="false">http://www.jaredlander.com/?p=766</guid>
		<description><![CDATA[
With the Super Bowl only hours away now is your last chance to buy your boxes.  Assuming the last digits are not assigned randomly you can maximize your chances with a little analysis.  While I&#8217;ve seen plenty of sites giving the raw numbers, I thought a little visualization was in order.
In the graph above (made ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/02/Last-Digit-Distribution1.png"><img class="aligncenter size-full wp-image-783" title="Last Digit Distribution" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/02/Last-Digit-Distribution1.png" alt="" width="473" height="474" /></a></p>
<p style="text-align: left;"><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/02/Last-Digit-Distribution1.png"></a>With the <a href="http://www.nfl.com/superbowl/46">Super Bowl</a> only hours away now is your last chance to buy your <a href="http://www.printyourbrackets.com/superbowl100squares.html">boxes</a>.  Assuming the last digits are not assigned randomly you can maximize your chances with a <a href="http://statsinthewild.wordpress.com/2012/02/02/super-bowl-squares/">little analysis</a>.  While I&#8217;ve seen plenty of sites giving the raw numbers, I thought a little visualization was in order.</p>
<p style="text-align: left;">In the graph above (made using <a href="http://www.jaredlander.com/tag/ggplot/">ggplot2</a> in <a href="http://www.jaredlander.com/tag/r/">R</a>, of course) the bigger squares represent greater frequency.  The axes are labelled &#8220;Home&#8221; and &#8220;Away&#8221; for orientation, but in the Super Bowl that probably doesn&#8217;t matter too much, especially considering that Indianapolis is <a href="http://profootballtalk.nbcsports.com/2012/01/30/tom-coughlin-thinks-colts-fans-will-become-giants-fans-this-week/">(Peyton) Manning</a> territory so the locals will most likely be rooting for the Giants.  Further, I believe <a href="http://www.nfl.com/superbowl/42">Super Bowl XLII</a>, featuring the same two teams, had a disproportionate number of Giants fans.  Bias disclaimer:  <a href="http://www.giants.com/">GO BIG BLUE!!!</a></p>
<p style="text-align: left;"><a href="http://www.giants.com/"></a>Below is the same graph broken down by year to see how the distribution has changed over the past 20 years.<br />
<a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/02/Last-Digit-Distribution-by-Year5.png"><img class="aligncenter size-full wp-image-781" title="Last Digit Distribution by Year" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2012/02/Last-Digit-Distribution-by-Year5.png" alt="" width="473" height="474" /></a></p>
<p style="text-align: left;">All the data was scraped from <a href="http://www.pro-football-reference.com/">Pro Football Reference</a>.  All of my code and other graphs that didn&#8217;t make the cut are at my <a href="https://github.com/jaredlander/FootballScores">github site</a>.</p>
<p style="text-align: left;">As always, send any questions my way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredlander.com/2012/02/football-score-distributions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plumbing</title>
		<link>http://www.jaredlander.com/2011/12/plumbing/</link>
		<comments>http://www.jaredlander.com/2011/12/plumbing/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 17:51:29 +0000</pubDate>
		<dc:creator>Jared</dc:creator>
				<category><![CDATA[Food]]></category>
		<category><![CDATA[Science]]></category>

		<guid isPermaLink="false">http://www.jaredlander.com/?p=754</guid>
		<description><![CDATA[Taking a break from my normal exposition on stats, New York or pizza I&#8217;d like to espouse the wonders of baking soda and vinegar!
My sink was clogged, not with anything specific, but just years worth of gunk.  So after scraping out what I could with my hands and a wire hanger&#8211;and wanting to avoid caustic ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/12/IMG_6278.jpg"><img class="aligncenter size-medium wp-image-758" title="IMG_6278" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/12/IMG_6278-300x225.jpg" alt="" width="300" height="225" /></a>Taking a break from my normal exposition on <a href="http://www.jaredlander.com/category/statistics/" target="_self">stats</a>, <a href="http://www.jaredlander.com/category/new-york/" target="_self">New York</a> or <a href="http://www.jaredlander.com/category/pizza/" target="_self">pizza</a> I&#8217;d like to espouse the wonders of baking soda and vinegar!</p>
<p>My sink was clogged, not with anything specific, but just years worth of gunk.  So after scraping out what I could with my hands and a wire hanger&#8211;and wanting to avoid caustic chemicals like <a href="http://www.drano.com/en-US/Pages/Home.aspx" target="_self">Drano</a>&#8211;I searched the Internet to see if <a href="http://www.listerine.com/" target="_self">Listerene</a> or<a href="http://www.coca-cola.com/" target="_self"> Coca-Cola</a> might do the trick.  But <a href="http://home.howstuffworks.com/home-improvement/plumbing/how-to-unclog-a-drain.htm" target="_self">extensive</a> <a href="http://www.motherearthnews.com/Do-It-Yourself/2007-12-01/How-to-Unclog-Drains-Without-Chemicals.aspx?page=2" target="_self">searching</a> <a href="http://bonzaiaphrodite.com/2009/06/natural-homemade-drain-o-or-how-to-unclog-without-chemicals/" target="_self">led</a> me to <a href="http://en.wikipedia.org/wiki/Sodium_bicarbonate" target="_self">baking soda</a> and <a href="http://en.wikipedia.org/wiki/Vinegar" target="_self">vinegar</a>.</p>
<p>It&#8217;s very simple:  Stuff a half cup of <a href="http://www.armandhammer.com/deodorization/baking-soda/landing.aspx" target="_self">baking soda</a> into the train then pour a half cup of <a href="http://www.heinzvinegar.com/products-distilled-white-vinegar.aspx">vinegar</a> down it, return the sink stopper and wait 15 minutes.  Then pour down another half cup of vinegar, close the stopper and wait another 15 minutes.  After that pour a gallon (a tea kettle&#8217;s worth) of boiling water down the drain and you&#8217;re done!  Not only will it unclog your drain, it leaves all the chrome shining like new!</p>
<p>For those of us who never got to make a <a href="http://www.volcanolive.com/model.html">model volcano</a> in science class it was really awesome watching the baking soda and vinegar react</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredlander.com/2011/12/plumbing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cell Phone Tracking for Disaster Relief</title>
		<link>http://www.jaredlander.com/2011/09/cell-phone-tracking-for-disaster-relief/</link>
		<comments>http://www.jaredlander.com/2011/09/cell-phone-tracking-for-disaster-relief/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 03:11:29 +0000</pubDate>
		<dc:creator>Jared</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[cell phone]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[NYC Data Mafia]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[Richard Garfield]]></category>
		<category><![CDATA[spatial]]></category>

		<guid isPermaLink="false">http://www.jaredlander.com/?p=739</guid>
		<description><![CDATA[A new study, reported in the New York Times, tracked population movements in post-earthquake Haiti using cell phone data.  The article grabbed my attention because one of the authors, Richard Garfield (whom I have done numerous projects with and who has his own Wikipedia entry!), had told me about this very study just a few ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/09/Nokia-1100.jpg"><img class="alignleft size-medium wp-image-748" title="Nokia 1100" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/09/Nokia-1100-135x300.jpg" alt="" width="135" height="300" /></a>A new <a href="http://www.plosmedicine.org/article/info%3Adoi%2F10.1371%2Fjournal.pmed.1001083;jsessionid=BA6AEC2DC467EFD46AC4488256EA1829.ambra02">study</a>, reported in the <a href="http://www.nytimes.com/2011/09/06/health/06global.html?_r=1&amp;src=rechp">New York Times</a>, tracked population movements in <a href="http://www.msnbc.msn.com/id/34835478/ns/world_news-haiti/t/haiti-earthquake-how-help/#.TmgsF2iF_ug">post-earthquake Haiti</a> using cell phone data.  The article grabbed my attention because one of the authors, <a href="http://sklad.cumc.columbia.edu/nursing/newFacProfiles/profile2.php?uni=rmg3">Richard Garfield</a> (whom I have done numerous <a href="http://www.jaredlander.com/projects/">projects</a> with and who has his own <a href="http://en.wikipedia.org/wiki/Richard_Garfield_(nursing_professor)">Wikipedia entry</a>!), had told me about this very study just a few months ago.</p>
<p>Over dinner in New York&#8217;s <a href="http://chowhound.chow.com/topics/257037">Little India</a> he explained how the largest cell phone company in Haiti provided him with anonymized cell tower records.  As <a href="http://www.tuaw.com/2011/04/25/a-roundup-of-todays-locationgate-news/">many</a> <a href="http://nymag.com/daily/intel/2011/04/how_you_feel_about_smartphones.html">people</a> are <a href="http://www.bgr.com/2011/04/22/google-our-smartphone-location-tracking-is-opt-in/">aware</a>, cell phones&#8211;even those <a href="http://www.gsmarena.com/nokia_6230-566.php">without GPS</a>&#8211;report their locations back to cell towers at regular intervals.  By tracking the daily position of the phones before and after the earthquake they were able to determine that 20% of Port-Au-Prince&#8217;s population had left the capitol within 19 days of the disaster.</p>
<p>They used plenty of solid math in the analysis and amazingly did it all without resorting to spatial statistics.  They have some nice map-based visualizations but I&#8217;ve been meaning to get the data from Dr. Garfield so I can attempt something similar to the amazing work done by the <a href="http://www.jaredlander.com/?s=data+mafia&amp;x=0&amp;y=0">NYC Data Mafia</a> on the <a href="http://bits.blogs.nytimes.com/2010/08/18/visualizing-the-wikileaks-war-logs/">WikiLeaks Afghanistan data</a>.  Though I don&#8217;t promise anything nearly as good.</p>
<p>It is also worth noting that they did this at a fraction of the cost and time of an extensive <a href="http://www.nytimes.com/2011/09/06/health/06global.html?_r=1&amp;src=rechp">UN</a> survey.  That survey only had about 2,500 respondents whereas the cell phone project incorporated around 1.9 million people without them spending valuable time with an interviewer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredlander.com/2011/09/cell-phone-tracking-for-disaster-relief/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Succeed in Scrabble</title>
		<link>http://www.jaredlander.com/2011/06/how-to-succeed-in-scrabble/</link>
		<comments>http://www.jaredlander.com/2011/06/how-to-succeed-in-scrabble/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 13:00:40 +0000</pubDate>
		<dc:creator>Jared</dc:creator>
				<category><![CDATA[Statistics]]></category>
		<category><![CDATA[brute force]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[plyr]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[scrabble]]></category>

		<guid isPermaLink="false">http://www.jaredlander.com/?p=693</guid>
		<description><![CDATA[

While playing Words with Friends my randomly chosen opponent played &#8220;radiale&#8221; as her first word.  Since that used up all of her tiles, she received a bonus on top of all the points the word itself got, resulting in a one-move score of 53 points!  Rather than being impressed I was upset at the large ]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/06/Scrabble-2.png"></a><br />
<a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/06/Scrabble-11.png"><img class="aligncenter size-medium wp-image-699" title="First Scrabble Move" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/06/Scrabble-11-e1309141834282-252x300.png" alt="" width="252" height="300" /></a></p>
<p>While playing <a href="http://www.wordswithfriends.com/">Words with Friends</a> my randomly chosen opponent played &#8220;radiale&#8221; as her first word.  Since that used up all of her tiles, she received a bonus on top of all the points the word itself got, resulting in a one-move score of 53 points!  Rather than being impressed I was upset at the large deficit I would have to overcome.</p>
<p>To combat this I did what comes naturally:  Write an <a href="http://www.jaredlander.com/tag/r/">R</a> script to find the perfect word!</p>
<p>Needing to combine my seven letters with one of her letters there were two routes I could take.  The first would be for each combination of my seven letters and one of hers, find all 40,320 (8!) permutations then hit dictionary.com to see if it is a real word for a total of 282,240 (8!*7) http calls.  That seemed a bit excessive and impractical so I moved on to the next idea.</p>
<p>So, first thing I did was pull a list of common <a href="http://www.poslarchive.com/math/scrabble/lists/common-8.html">eight-letter words</a>. Then for each combination of my letters and one of hers (only 7 iterations) I checked if those letters (in any order) matched the letters in any of the possible words.  Once a match was found there was a check for the counts of the letters and if that passed then the word was recorded as a true match.</p>
<p>The algorithm took about 17 seconds to run and found me one possible word for my letters combined with one of hers:  &#8221;headrace&#8221;, for 63 points!  Perhaps I should have been able to figure that out on my own, but where would be the fun in that.  Find the code after the break.</p>
<p style="text-align: center;"><img class="aligncenter" title="Second Scrabble Move" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/06/Scrabble-2-e1309142224266-256x300.png" alt="" width="256" height="300" /></p>
<div>
<p><span style="color: #0000ee; -webkit-text-decorations-in-effect: underline;"><span id="more-693"></span></span></p>
<pre><code lang="r">require(RCurl)
require(XML)
require(plyr)

myLetters &lt;- "ercaehd"
theirLetters &lt;- "radiale"

wordSite &lt;- getURL("http://www.poslarchive.com/math/scrabble/lists/common-8.html")  # get page with words

# parse out the page
wordsParsed &lt;- htmlTreeParse(wordSite, handlers=list("pre"=function(x, ...){ x }, "p"=function(x, ...){ NULL },
                                                    "head"=function(x, ...){ NULL }), asTree=TRUE)

# get just the list of words
words &lt;- as.character(wordsParsed$children$html[["body"]][["pre"]][["text"]])
words &lt;-gsub("\n", " ", words)  # sub out carriage return characters for spaces

## Turn the block of words into a nice list, each element of which is a vector of characters
words &lt;- strsplit(words, split=" ")[[6]]    # split the long string into a vector seperating by spaces
words &lt;- as.list(words)     # change from vector to list
words &lt;- lapply(words, strsplit, split="")  # split each element of the list into a vector of it's characters

findAllWords &lt;- function(baseLetters, theirWord, listOfWords)
{
    extraLetters &lt;- strsplit(theirWord, split="")[[1]]   # split their word into letters, probably should have removed redundant letters first for a slight efficiency gain

    wordSuccess &lt;- vector("list", length(extraLetters))

    for(a in 1:length(extraLetters))
    {
        seedLetters &lt;- paste(baseLetters, extraLetters[a], sep="")
        #seedLetters &lt;- strsplit(seedLetters, split="")[[1]]

        wordSuccess[[a]] &lt;- checkForWord(words=listOfWords, letters=seedLetters)
    }

    return(wordSuccess)
}

checkForWord &lt;- function(words, letters)
{
    holder &lt;- vector("list", length(words)) # to hold results
    letters &lt;- strsplit(letters, split="")[[1]]  # split up letters
    letterFrame &lt;- data.frame(Letters=letters, stringsAsFactors=FALSE)  # to facilitate counting
    letterCount &lt;- ddply(letterFrame, .(Letters), nrow)   # counts for each letter
    rm(letterFrame); gc()
    names(letterCount)[2] &lt;- "LetterCount"

    ## loop through every word in the list and see if our letters are found in there
    for(i in 1:length(words))
    {
        if(all(letters %in% words[[i]][[1]]))   # if all the letters are found in the word
        {
            # check counts
            wordFrame &lt;- data.frame(Letters=words[[i]][[1]], stringsAsFactors=FALSE)    # put letters from word into DF
            wordCount &lt;- ddply(wordFrame, .(Letters), nrow) # get counts
            rm(wordFrame); gc()
            names(wordCount)[2] &lt;- "WordLetterCount"

            joinedLetters &lt;- join(letterCount, wordCount, by="Letters") # join the tables for a comparison

            holder[[i]] &lt;- all(with(joinedLetters, LetterCount == WordLetterCount)) # holder gets the result of the comparison
        }else
        {
            holder[[i]] &lt;- FALSE
        }
    }

    holder &lt;- laply(holder, function(x) x) # convert to vector

    if(sum(holder) == 0)
    {
        return(sum(holder))
    }else
    {
        return(which(holder == TRUE))
    }
}

system.time(result &lt;- findAllWords(baseLetters=myLetters, theirWord=theirLetters, listOfWords=words))</code></pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredlander.com/2011/06/how-to-succeed-in-scrabble/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The FBI Needs Your Help</title>
		<link>http://www.jaredlander.com/2011/03/the-fbi-needs-your-help/</link>
		<comments>http://www.jaredlander.com/2011/03/the-fbi-needs-your-help/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 03:06:48 +0000</pubDate>
		<dc:creator>Jared</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[FBI]]></category>
		<category><![CDATA[NSA]]></category>

		<guid isPermaLink="false">http://www.jaredlander.com/?p=689</guid>
		<description><![CDATA[The FBI has put out a public request for help cracking a code.  The code above was found in the pants of a murder victim over 10 years ago.  Despite some of the best code breakers in the world give it a shot, they have not been able to break the code.  I wonder if ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/FBI-Puzzle.bmp"><img class="aligncenter size-full wp-image-690" title="FBI Puzzle" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/FBI-Puzzle.bmp" alt="" /></a>The <a href="http://www.fbi.gov">FBI</a> has put out a public request for <a href="http://www.fbi.gov/news/stories/2011/march/cryptanalysis_032911">help cracking a code</a>.  The code above was found in the pants of a murder victim over 10 years ago.  Despite some of the best code breakers in the world give it a shot, they have not been able to break the code.  I wonder if the <a href="http://www.nsa.gov/">NSA</a> had a go at it.  Couldn&#8217;t they try brute force like in <a href="http://www.danbrown.com">Dan Brown&#8217;s</a> <em><a href="http://www.amazon.com/Digital-Fortress-Thriller-Dan-Brown/dp/0312263120">Digital Fortress</a></em>?  Yes I referenced Dan Brown in the same paragraph as the NSA, deal with it.</p>
<p>If you think you can help send a letter to:</p>
<p>FBI Laboratory<br />
Cryptanalysis and Racketeering Records Unit<br />
2501 Investigation Parkway<br />
Quantico, VA 22135<br />
Attn: Ricky McCormick Case</p>
<p>There&#8217;s no reward but you&#8217;d be helping your country.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredlander.com/2011/03/the-fbi-needs-your-help/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Pi Day Photos</title>
		<link>http://www.jaredlander.com/2011/03/pi-day-photos/</link>
		<comments>http://www.jaredlander.com/2011/03/pi-day-photos/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 16:53:17 +0000</pubDate>
		<dc:creator>Jared</dc:creator>
				<category><![CDATA[Food]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[New York]]></category>
		<category><![CDATA[Pizza]]></category>
		<category><![CDATA[Artichoke]]></category>
		<category><![CDATA[Drew Conway]]></category>
		<category><![CDATA[Harlan Harris]]></category>
		<category><![CDATA[High Line]]></category>
		<category><![CDATA[John]]></category>
		<category><![CDATA[Mike Dewar]]></category>
		<category><![CDATA[NYC Data Mafia]]></category>
		<category><![CDATA[Pi Cake]]></category>
		<category><![CDATA[Pi Day]]></category>

		<guid isPermaLink="false">http://www.jaredlander.com/?p=675</guid>
		<description><![CDATA[As mentioned earlier, yesterday was Pi Day so a bunch of statisticians and other such nerds celebrated at the new(ish) Artichoke Basille near the High Line.  We had three pies:  the signature Artichoke, the Margherita and the Anchovy, which was delicious but only some of us ate.  And of course we had our custom cake ]]></description>
			<content:encoded><![CDATA[<div id="attachment_676" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/pi_day_2011_big-01.jpg"><img class="size-medium wp-image-676" title="pi_day_2011_big 01" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/pi_day_2011_big-01-300x200.jpg" alt="" width="300" height="200" /></a>
<p class="wp-caption-text">Pi Day Celebrants</p>
</div>
<p style="text-align: left;"><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/pi_day_2011_big-02.jpg"></a>As mentioned earlier, yesterday was <a href="http://www.jaredlander.com/2011/03/happy-pi-day/">Pi Day</a> so a bunch of statisticians and other such nerds celebrated at the new(ish) <a href="http://www.jaredlander.com/2010/09/the-new-artichoke/">Artichoke Basille</a> near the <a href="http://www.thehighline.org/">High Line</a>.  We had three pies:  the signature Artichoke, the Margherita and the Anchovy, which was delicious but only some of us ate.  And of course we had our custom cake from <a href="https://www.facebook.com/ChrissieCookCakes">Chrissie Cook</a>.</p>
<p>The photos were taken by <a href="http://www.jaredlander.com/tag/john/">John</a>.</p>
<p style="text-align: center;">
<div class="wp-caption aligncenter" style="width: 210px"><img title="pi_day_2011_big 02" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/pi_day_2011_big-02-200x300.jpg" alt="" width="200" height="300" />
<p class="wp-caption-text">Pi Cake 2011</p>
</div>
<div id="attachment_683" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/pi_day_2011_big-031.jpg"><img class="size-medium wp-image-683" title="pi_day_2011_big 03" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/pi_day_2011_big-031-300x200.jpg" alt="NYC Data Mafia" width="300" height="200" /></a>
<p class="wp-caption-text">NYC Data Mafia</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredlander.com/2011/03/pi-day-photos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy Pi Day! (Update: Sounds of Pi Video)</title>
		<link>http://www.jaredlander.com/2011/03/happy-pi-day/</link>
		<comments>http://www.jaredlander.com/2011/03/happy-pi-day/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 21:10:19 +0000</pubDate>
		<dc:creator>Jared</dc:creator>
				<category><![CDATA[Food]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Pizza]]></category>
		<category><![CDATA[Albert Einstein]]></category>
		<category><![CDATA[Cake]]></category>
		<category><![CDATA[Chrissie Cook]]></category>
		<category><![CDATA[Drew Conway]]></category>
		<category><![CDATA[NYC Data Mafia]]></category>
		<category><![CDATA[Pi]]></category>
		<category><![CDATA[Pi Cake]]></category>
		<category><![CDATA[Pi Day]]></category>

		<guid isPermaLink="false">http://www.jaredlander.com/?p=665</guid>
		<description><![CDATA[Happy Pi Day everybody!  I&#8217;ll be out celebrating with the rest of the NYC Data Mafia eating pizza and devouring the above Pi Cake, custom baked by Chrissie Cook.
Today is also Albert Einstein&#8217;s birthday so there are plenty of reasons to have fun.
The cake below was my first ever Pi Cake in what is sure ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/Pi-Cake-2011.jpg"><img class="aligncenter size-medium wp-image-666" title="Pi Cake 2011" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/Pi-Cake-2011-300x225.jpg" alt="Pi Cake" width="300" height="225" /></a>Happy Pi Day everybody!  I&#8217;ll be out celebrating with the rest of the <a href="http://www.jaredlander.com/2010/12/nyc-data-mafia-t-shirts/">NYC Data Mafia</a> eating pizza and devouring the above Pi Cake, custom baked by <a href="https://www.facebook.com/ChrissieCookCakes">Chrissie Cook</a>.</p>
<p>Today is also <a href="http://nobelprize.org/nobel_prizes/physics/laureates/1921/einstein-bio.html">Albert Einstein&#8217;s</a> birthday so there are plenty of reasons to <a href="http://news.cnet.com/8301-17938_105-20043006-1.html">have</a> <a href="http://www.google.com/hostednews/afp/article/ALeqM5gzaRyXRtY8cf0Z5jEl4JtKFlyRHQ?docId=CNG.9cac656ee218c88029a4490458898142.791">fun</a>.</p>
<p>The cake below was my first ever Pi Cake in what is sure to become an annual tradition.</p>
<p><a href="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/IMG_1325.jpg"><img class="aligncenter size-medium wp-image-667" title="Pi Cake 2009" src="http://www.jaredlander.com/wordpress/wordpress-2.9.2/wordpress/wp-content/uploads/2011/03/IMG_1325-300x225.jpg" alt="Pi Cake 2009" width="300" height="225" /></a></p>
<p><strong>Update:</strong> Drew Conway does far more <a href="http://www.drewconway.com/zia/?p=2667">justice</a> to our fair, irrational, transcendental number.</p>
<p><strong>Update 2</strong>:  Engadget posted this awesome video of &#8220;<a href="http://www.engadget.com/2011/03/14/its-pi-day-do-you-know-what-3-1415926535897932384626433832795/">What Pi Sounds Like.</a>&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredlander.com/2011/03/happy-pi-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

