<?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>TheSpicyChicken &#187; Development</title>
	<atom:link href="http://thespicychicken.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://thespicychicken.com</link>
	<description>n'th generation research</description>
	<lastBuildDate>Sun, 27 Nov 2011 19:17:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>BCSRank &#8211; Week 13</title>
		<link>http://thespicychicken.com/2011/11/27/bcsrank-week-13/</link>
		<comments>http://thespicychicken.com/2011/11/27/bcsrank-week-13/#comments</comments>
		<pubDate>Sun, 27 Nov 2011 19:13:48 +0000</pubDate>
		<dc:creator>Spicy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Science]]></category>

		<guid isPermaLink="false">http://thespicychicken.com/?p=266</guid>
		<description><![CDATA[Week 13 was rivalry week with lots of potentially exciting games. However, there weren&#8217;t too many surprises as the favored team won in nearly all the top 25 match-ups. A quality win over Notre Dame pushed Stanford up a few notches, while OSU falls a notch on a bye week. At this point BCSRank would [...]]]></description>
			<content:encoded><![CDATA[<p>Week 13 was rivalry week with lots of potentially exciting games. However, there weren&#8217;t too many surprises as the favored team won in nearly all the top 25 match-ups.</p>
<p>A quality win over Notre Dame pushed Stanford up a few notches, while OSU falls a notch on a bye week.</p>
<p>At this point BCSRank would put LSU vs Houston in the BCS Championship game &#8212; a scenario that is incredibly unlikely. Also, while Bama sits on nearly all ranking systems at a solid #2, according the BCSRank they are down at #7. Again, I suspect there is bias against teams in good conferences and need a way to address this. I would like to do this without sacrificing the generality of the method.</p>
<pre>RANK                     TEAM LOSSES      SCORE
  1                       LSU      0      0.01554
  2                   Houston      0      0.01212
  3              Oklahoma St.      1      0.01153
  4                 Boise St.      1      0.01118
  5                  Stanford      1      0.01097
  6             Virginia Tech      1      0.01094
  7                   Alabama      1      0.01086
  8                       TCU      2      0.01059
  9                  Oklahoma      2      0.01054
 10       Southern California      2      0.01047
 11                    Oregon      2      0.01042
 12                  Michigan      2      0.01041
 13              Michigan St.      2      0.01029
 14            South Carolina      2      0.01012
 15                   Clemson      3      0.01007
 16                  Nebraska      3      0.01000
 17                 Wisconsin      2      0.00999
 18                    Baylor      3      0.00986
 19                  Arkansas      2      0.00973
 20                Kansas St.      2      0.00957
 21            Southern Miss.      2      0.00935
 22                   Georgia      2      0.00932
 23                Notre Dame      4      0.00916
 24                  Iowa St.      5      0.00901
 25              Arkansas St.      2      0.00899</pre>
]]></content:encoded>
			<wfw:commentRss>http://thespicychicken.com/2011/11/27/bcsrank-week-13/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BCSRank &#8211; An open source BCS ranking algorithm based on Google&#8217;s PageRank</title>
		<link>http://thespicychicken.com/2011/11/25/bcsrank-an-open-source-bcs-ranking-algorithm-based-on-googles-pagerank/</link>
		<comments>http://thespicychicken.com/2011/11/25/bcsrank-an-open-source-bcs-ranking-algorithm-based-on-googles-pagerank/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 21:18:32 +0000</pubDate>
		<dc:creator>Spicy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Science]]></category>

		<guid isPermaLink="false">http://thespicychicken.com/?p=263</guid>
		<description><![CDATA[I&#8217;ve been having a great time following the Stanford Cardinal this year. There has been quite a bit of talk about how the ranking system is flawed and the computer rankings &#8220;don&#8217;t like Stanford&#8221; and is better than their rank would indicate (currently #6). As a student of statistics/computer science and a fan of college football [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been having a great time <a href="http://nickandnoah.com">following the Stanford Cardinal</a> this year. There has been quite a bit of talk about how the <a href="http://espn.go.com/college-football/story/_/id/7270999/david-shaw-stanford-cardinal-says-bcs-flawed">ranking system is flawed</a> and the computer rankings &#8220;don&#8217;t like Stanford&#8221; and is better <a href="http://espn.go.com/college-football/bcs">than their rank</a> would indicate (currently #6).</p>
<p>As a student of statistics/computer science and a fan of college football &#8212; I got pretty interested in just how these computer rankings work. <a href="http://www.bcsfootball.org/news/story?id=4765872">This pages</a> lists the different algorithms that are used, but the sites don&#8217;t really describe how the teams are ranked (probably trade secrets or something).</p>
<p>It occurred to me that Larry Page and Sergey Brin invented a this little algorithm to rank web pages on the internet based on their credibility. The idea behind their ranking algorithm is that more credible pages will have more links to them AND that links from more credible pages are worth more. Well, this is quite similar to college football. Teams that win lots of games are better teams (i.e. more credible). So instead of links between pages we have links between teams. A link is established between each team that has completed a game. The link is directional and goes from the team that lost to the team that won.</p>
<p>This is quite intuitive in that if you beat a team that loses to a lot of teams (e.g. a webpage that promiscuously links to all other pages) you are going to get less credit than if you beat a team that has never lost (e.g. a page that all other pages point to, but where it only points to you). Unless two teams play twice in a year (which typically won&#8217;t happen in the regular season) then there will at most one link between each team.</p>
<p>My implementation is far from finished and there are definitely some limitations, but I figure the internet may be able to help me improve the method so here it is.</p>
<p>As an example, lets say we have three teams (A, B, and C), we define our link matrix according the results of those teams playing each other.</p>
<pre>L = ((0, 0, 0),</pre>
<pre>     (1, 0, 0),</pre>
<pre>     (1, 1, 0))</pre>
<p>We call the matrix L for links for losses, you pick. When we try to invert this matrix according to the algorithm we cannot so to make the matrix non-singular I set the diagonal equal to 1.</p>
<pre>L = ((1, 0, 0),</pre>
<pre>     (1, 1, 0),</pre>
<pre>     (1, 1, 1))</pre>
<p>This makes the matrix invertible and we can implement the algorithm as <a href="http://en.wikipedia.org/wiki/PageRank">described on Wikipedia</a>. This means that team A has never lost, team B lost only to team A, and team C lost to both A and B.</p>
<p>The other parameter we need is the dampening factor &#8212; which for the PageRank algorithm is the probability that a random surfer goes to a random page on the internet rather than using the links. When this value is set to 1 that means the surfer always uses the links and will end up on a terminally linked page. For our football ranking this means that the value will congregate in the top one or two teams (analogous to the surfer ending up at a terminally linked page). We want to spread out the scores a bit more than that so we will set this dampening factor quite low (~0.3).</p>
<p>&nbsp;</p>
<p>So, in week 13 of the 2011 season, what does PageRank say about the way the teams should be ranked? Here are the top 25.</p>
<pre>Rank                     Team  Losses  RankScore
------------------------------------------------
  1                       LSU   0      0.01474
  2              Oklahoma St.   1      0.01192
  3                   Houston   0      0.01179
  4                   Alabama   1      0.01141
  5                 Boise St.   1      0.01094
  6             Virginia Tech   1      0.01082
  7                       TCU   2      0.01070
  8                  Stanford   1      0.01055
  9                   Clemson   2      0.01046
 10                  Oklahoma   2      0.01040
 11       Southern California   2      0.01039
 12                  Michigan   2      0.01037
 13                  Arkansas   1      0.01036
 14                    Oregon   2      0.01029
 15              Michigan St.   2      0.01009
 16                  Nebraska   3      0.01004
 17                Kansas St.   2      0.00979
 18                    Baylor   3      0.00972
 19            South Carolina   2      0.00952
 20                  Penn St.   2      0.00951
 21                 Wisconsin   2      0.00950
 22            Southern Miss.   2      0.00941
 23                Notre Dame   3      0.00937
 24                  Iowa St.   4      0.00927
 25                   Rutgers   3      0.00917</pre>
<p>&nbsp;</p>
<p>Now this is pretty good for a first pass at ranking. LSU is clearly the best team going into week 13 and indeed they do come out on top of our rankings. One interesting feature of our rankings is that Houston is right there at #3 above Alabama. This is the result of our algorithm assuming all teams are equal at the start.  It&#8217;s a little disappointing that Stanford is sitting at #8 behind a two-loss TCU, but TCU has beat &#8220;higher quality&#8221; opponents (i.e. Boise State) and that&#8217;s contributing their score.</p>
<p>Another interesting/curious ranking is Arkansas sitting very low at #13. This makes me wonder about biases against conferences that are filled with good teams (i.e. SEC West). Because a team has to play the teams in their own conference more than from other conferences this may bias against teams in good conferences. I have not figured out a way to visualize or estimate this bias yet. Once we can understand it we can invent methods for removing it.</p>
<p>If you have ideas for improving this method please feel free to comment. This may ultimately prove a futile effort and will not perform as well as those established ranking systems &#8212; but at least it&#8217;s an open solution based on some sound CS models.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://thespicychicken.com/2011/11/25/bcsrank-an-open-source-bcs-ranking-algorithm-based-on-googles-pagerank/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom iTerm Color Themes</title>
		<link>http://thespicychicken.com/2010/03/27/custom-iterm-color-themes/</link>
		<comments>http://thespicychicken.com/2010/03/27/custom-iterm-color-themes/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 17:09:56 +0000</pubDate>
		<dc:creator>Spicy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[colors]]></category>
		<category><![CDATA[iTerm]]></category>
		<category><![CDATA[themes]]></category>

		<guid isPermaLink="false">http://thespicychicken.com/?p=196</guid>
		<description><![CDATA[I just found this blog post on kpumuk.info here (http://kpumuk.info/mac-os-x/customizing-iterm-creating-a-display-profile-with-pastel-colors/) and it has changed my iTerm life. I used to be a Terminal.app fanboy but between TextMate&#8217;s iTerm integration and this color theme, I am a fully iTerm man now. Because this has changed my life so much, I&#8217;m going to repost the script that [...]]]></description>
			<content:encoded><![CDATA[<p>I just found this blog post on kpumuk.info here (<a href="http://kpumuk.info/mac-os-x/customizing-iterm-creating-a-display-profile-with-pastel-colors/">http://kpumuk.info/mac-os-x/customizing-iterm-creating-a-display-profile-with-pastel-colors/</a>) and it has changed my iTerm life.  I used to be a Terminal.app fanboy but between TextMate&#8217;s iTerm integration and this color theme, I am a fully iTerm man now.  Because this has changed my life so much, I&#8217;m going to repost the script that sets the default iTerm color scheme to this beautiful pastel on dark style.</p>
<p>I&#8217;m only posting this for prosterity sake, you should really go to the original blog post (link above) for more detailed information.</p>
<p>Close down iTerm and run this bash script from Terminal.  Open up iTerm and you&#8217;ll see the changes.</p>
<div class="code">
#!/bin/bash</p>
<p>PASTEL=&#8217;&#8221;Pastel&#8221; =     {<br />
    &#8220;Ansi 0 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.3097887;<br />
        &#8220;Green Component&#8221; = 0.3097887;<br />
        &#8220;Red Component&#8221; = 0.3097887;<br />
    };<br />
    &#8220;Ansi 1 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.3764706;<br />
        &#8220;Green Component&#8221; = 0.4235294;<br />
        &#8220;Red Component&#8221; = 1;<br />
    };<br />
    &#8220;Ansi 10 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.6727703;<br />
        &#8220;Green Component&#8221; = 1;<br />
        &#8220;Red Component&#8221; = 0.8094148;<br />
    };<br />
    &#8220;Ansi 11 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.7996491;<br />
        &#8220;Green Component&#8221; = 1;<br />
        &#8220;Red Component&#8221; = 1;<br />
    };<br />
    &#8220;Ansi 12 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.9982605;<br />
        &#8220;Green Component&#8221; = 0.8627756;<br />
        &#8220;Red Component&#8221; = 0.7116503;<br />
    };<br />
    &#8220;Ansi 13 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.9965209;<br />
        &#8220;Green Component&#8221; = 0.6133059;<br />
        &#8220;Red Component&#8221; = 1;<br />
    };<br />
    &#8220;Ansi 14 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.9970397;<br />
        &#8220;Green Component&#8221; = 0.8763103;<br />
        &#8220;Red Component&#8221; = 0.8759136;<br />
    };<br />
    &#8220;Ansi 15 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 1;<br />
        &#8220;Green Component&#8221; = 1;<br />
        &#8220;Red Component&#8221; = 1;<br />
    };<br />
    &#8220;Ansi 2 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.3764706;<br />
        &#8220;Green Component&#8221; = 1;<br />
        &#8220;Red Component&#8221; = 0.6588235;<br />
    };<br />
    &#8220;Ansi 3 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.7137255;<br />
        &#8220;Green Component&#8221; = 1;<br />
        &#8220;Red Component&#8221; = 1;<br />
    };<br />
    &#8220;Ansi 4 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.9960784;<br />
        &#8220;Green Component&#8221; = 0.7960784;<br />
        &#8220;Red Component&#8221; = 0.5882353;<br />
    };<br />
    &#8220;Ansi 5 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.9921569;<br />
        &#8220;Green Component&#8221; = 0.4509804;<br />
        &#8220;Red Component&#8221; = 1;<br />
    };<br />
    &#8220;Ansi 6 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.9960784;<br />
        &#8220;Green Component&#8221; = 0.772549;<br />
        &#8220;Red Component&#8221; = 0.7764706;<br />
    };<br />
    &#8220;Ansi 7 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.9335317;<br />
        &#8220;Green Component&#8221; = 0.9335317;<br />
        &#8220;Red Component&#8221; = 0.9335317;<br />
    };<br />
    &#8220;Ansi 8 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.4862745;<br />
        &#8220;Green Component&#8221; = 0.4862745;<br />
        &#8220;Red Component&#8221; = 0.4862745;<br />
    };<br />
    &#8220;Ansi 9 Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.6901961;<br />
        &#8220;Green Component&#8221; = 0.7137255;<br />
        &#8220;Red Component&#8221; = 1;<br />
    };<br />
    &#8220;Anti Alias&#8221; = 1;<br />
    &#8220;Background Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0;<br />
        &#8220;Green Component&#8221; = 0;<br />
        &#8220;Red Component&#8221; = 0;<br />
    };<br />
    Blur = 1;<br />
    &#8220;Bold Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.5067359;<br />
        &#8220;Green Component&#8221; = 0.5067359;<br />
        &#8220;Red Component&#8221; = 0.9909502;<br />
    };<br />
    Columns = 120;<br />
    &#8220;Cursor Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.3764706;<br />
        &#8220;Green Component&#8221; = 0.6470588;<br />
        &#8220;Red Component&#8221; = 1;<br />
    };<br />
    &#8220;Cursor Text Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 1;<br />
        &#8220;Green Component&#8221; = 1;<br />
        &#8220;Red Component&#8221; = 1;<br />
    };<br />
    &#8220;Disable Bold&#8221; = 0;<br />
    Font = &#8220;Monaco 14&#8243;;<br />
    &#8220;Foreground Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 1;<br />
        &#8220;Green Component&#8221; = 1;<br />
        &#8220;Red Component&#8221; = 1;<br />
    };<br />
    &#8220;Horizontal Character Spacing&#8221; = 1;<br />
    NAFont = &#8220;Monaco 14&#8243;;<br />
    Rows = 24;<br />
    &#8220;Selected Text Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.9476005;<br />
        &#8220;Green Component&#8221; = 0.9476005;<br />
        &#8220;Red Component&#8221; = 0.9476005;<br />
    };<br />
    &#8220;Selection Color&#8221; =         {<br />
        &#8220;Blue Component&#8221; = 0.5153061;<br />
        &#8220;Green Component&#8221; = 0.2224857;<br />
        &#8220;Red Component&#8221; = 0.2099074;<br />
    };<br />
    Transparency = 0.1;<br />
    &#8220;Vertical Character Spacing&#8221; = 1;<br />
};&#8217;</p>
<p>DISPLAYS=`defaults read net.sourceforge.iTerm Displays | sed &#8220;s/}$//&#8221;`<br />
DISPLAYS+=$PASTEL<br />
DISPLAYS+=&#8221;}&#8221;<br />
defaults write net.sourceforge.iTerm Displays &#8220;$DISPLAYS&#8221;<br />
echo &#8220;Pastel display profile added&#8221;</p>
<p>BOOKMARKS=`defaults read net.sourceforge.iTerm Bookmarks | sed &#8216;s/&#8221;Display Profile&#8221; = &#8220;[^"]*&#8221;;/&#8221;Display Profile&#8221; = &#8220;Pastel&#8221;;/&#8217;`<br />
defaults write net.sourceforge.iTerm Bookmarks &#8220;$BOOKMARKS&#8221;<br />
echo &#8220;Pastel display profile installed as default&#8221;
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://thespicychicken.com/2010/03/27/custom-iterm-color-themes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>R Tip: Fitting Sigmoidal Data</title>
		<link>http://thespicychicken.com/2010/02/17/r-tip-fitting-sigmoidal-data/</link>
		<comments>http://thespicychicken.com/2010/02/17/r-tip-fitting-sigmoidal-data/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 07:12:54 +0000</pubDate>
		<dc:creator>Spicy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[sigmoid]]></category>

		<guid isPermaLink="false">http://thespicychicken.com/?p=175</guid>
		<description><![CDATA[Using R to fit a sigmoid function to experimental data.]]></description>
			<content:encoded><![CDATA[<p>
  Sigmoid functions are our friends and sometimes you have data which you would like to fit with a sigmoid function. We can use R to find such a fit.  First let us look at a sigmoid function.
</p>
<div class="code">
  y = 1 / (1 + exp( -a*x + b) )
</div>
<p>
  Now let&#8217;s say you are given a vector x and y, say:
</p>
<div class="code">
  x = c(0.00,0.02,0.04,0.06,0.08,0.10,0.12,0.14,0.16,0.18,0.20,0.24,0.26,<br/><br />
0.28,0.30,0.34,0.40,0.42,0.48,0.54,0.56,0.64,1.00)<br/><br />
  y = c(0.409742,0.319277,0.530120,0.377778,0.357143,0.608696,0.315789,<br/><br />
0.692308,0.642857,0.636364,0.750000,0.000000,0.833333,1.000000,<br/><br />
0.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,<br/><br />
1.000000,1.000000)
</div>
<p>
  In this case the y values here represent probabilities and one thing you’ll notice is that we have probs of 1 and 0. Both of which are bad. So we apply a little “laplace smoothing” to them:
</p>
<div class="code">
  y[y==0] = 0.001<br/><br />
  y[y==1] = 0.999
</div>
<p>
Now let&#8217;s look at what the data looks like.
</p>
<div class="code">
plot(x, y)
</div>
<p><a href="http://thespicychicken.com/wp-content/uploads/2010/02/RTip_Sigmoid_Fig1.png"><img src="http://thespicychicken.com/wp-content/uploads/2010/02/RTip_Sigmoid_Fig1-300x279.png" alt="" title="RTip_Sigmoid_Fig1" width="300" height="279" class="alignnone size-medium wp-image-186" /></a></p>
<p>
Well, it may be sigmoidal, maybe not. For now let’s assume we think it is. Which we do for the most part.
</p>
<p>
Okay, now let’s solve for a line in our sigmoid function:
</p>
<div class="code">
y = 1 / (1 + exp( a*x + b) )<br/><br />
1 + exp( a*x + b) = 1/ y<br/><br />
a*x + b = log ( (1/ y) &#8211; 1 )<br/>
</div>
<p>
Now the left hand side of the equation is a line and the right hand side is some logarithm of the y data. We can plot x versus this right hand side:
</p>
<div class="code">
new_y = log( 1 / y &#8211; 1 )<br/><br />
plot(x, new_y)
</div>
<p><a href="http://thespicychicken.com/wp-content/uploads/2010/02/RTip_Sigmoid_Fig2.png"><img src="http://thespicychicken.com/wp-content/uploads/2010/02/RTip_Sigmoid_Fig2-300x272.png" alt="" title="RTip_Sigmoid_Fig2" width="300" height="272" class="alignnone size-medium wp-image-187" /></a></p>
<p>
Looks pretty interesting and hopefully at this point it also looks kinda linear, which it kinda does.
</p>
<p>
Now let’s fit it with a line:
</p>
<div class="code">
lm.res <- lm( new_y ~ x )<br/><br />
lm.res
</div>
<p>Which produces this output:</p>
<div class="code">
Coefficients:<br/><br />
(Intercept)            x<br/><br />
1.122      -11.647<br/>
</div>
<p>We can also test the significance of the fit with an ANOVA.</p>
<div class="code">
anova(lm.res)
</div>
<p>Which produces this output:</p>
<div class="code">
Analysis of Variance Table<br/><br />
Response: new_y<br/><br />
Df Sum Sq Mean Sq F value    Pr(>F)<br/><br />
x          1 172.80 172.802  14.641 0.0009834 ***<br/>
</div>
<p>
And we can plot the resulting fit in linear space:
</p>
<p><a href="http://thespicychicken.com/wp-content/uploads/2010/02/RTip_Sigmoid_Fig3.png"><img src="http://thespicychicken.com/wp-content/uploads/2010/02/RTip_Sigmoid_Fig3-300x276.png" alt="" title="RTip_Sigmoid_Fig3" width="300" height="276" class="alignnone size-medium wp-image-188" /></a></p>
<p>
Now let’s see how our fit looks back in normal space using our formula with our derived a and b values.
</p>
<div class="code">
a = -11.647<br/><br />
b = 1.122<br/><br />
plot(x, y)<br/><br />
sim_x = (1:101-1)/100<br/><br />
points(sim_x, 1/(1+exp(a*sim_x+b)), type=&#8221;l&#8221;)<br/>
</div>
<p><a href="http://thespicychicken.com/wp-content/uploads/2010/02/RTip_Sigmoid_Fig4.png"><img src="http://thespicychicken.com/wp-content/uploads/2010/02/RTip_Sigmoid_Fig4-300x271.png" alt="" title="RTip_Sigmoid_Fig4" width="300" height="271" class="alignnone size-medium wp-image-189" /></a></p>
<p>
Voila! We have fit a sigmoid function to our data.</p>
]]></content:encoded>
			<wfw:commentRss>http://thespicychicken.com/2010/02/17/r-tip-fitting-sigmoidal-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snow Leopard Super FAIL</title>
		<link>http://thespicychicken.com/2009/08/29/snow-leopard-super-fail/</link>
		<comments>http://thespicychicken.com/2009/08/29/snow-leopard-super-fail/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 17:52:55 +0000</pubDate>
		<dc:creator>Spicy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[snow leopard]]></category>

		<guid isPermaLink="false">http://thespicychicken.com/2009/08/29/snow-leopard-super-fail/</guid>
		<description><![CDATA[Just got snow leopard in the mail and was so excited to install. Then got on Twitter to see what my friends were up to: http://twitter.com/caddymob I think I&#8217;m waiting now. UPDATE: Jason posted details describing his troubles and how he worked around it here: http://corneveaux.com/blog/installing-snow-leopard-a-big-fail-and-a-work-around]]></description>
			<content:encoded><![CDATA[<p>Just got snow leopard in the mail and was so excited to install.  Then got on Twitter to see what my friends were up to:</p>
<p><a title="Snow Leopard FAIL" href="http://twitter.com/caddymob">http://twitter.com/caddymob</a></p>
<p>I think I&#8217;m waiting now.</p>
<p>UPDATE:<br />
Jason posted details describing his troubles and how he worked around it here:<br />
<a href="http://corneveaux.com/blog/installing-snow-leopard-a-big-fail-and-a-work-around">http://corneveaux.com/blog/installing-snow-leopard-a-big-fail-and-a-work-around</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thespicychicken.com/2009/08/29/snow-leopard-super-fail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trick your friends&#8230;</title>
		<link>http://thespicychicken.com/2009/03/14/trick-your-friends/</link>
		<comments>http://thespicychicken.com/2009/03/14/trick-your-friends/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 01:52:58 +0000</pubDate>
		<dc:creator>Spicy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[guppy]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[trick]]></category>

		<guid isPermaLink="false">http://thespicychicken.com/2009/03/14/trick-your-friends/</guid>
		<description><![CDATA[Are your friends Gullible? Trick them with Guppy a free iPhone app. I don&#8217;t want to give too much away, but it&#8217;s loads of fun and it&#8217;s free. Download it now and have some fun with your friends! Free Download here. -Spicy]]></description>
			<content:encoded><![CDATA[<p>Are your friends Gullible?  Trick them with <a href="http://mophilia.com">Guppy</a> a free iPhone app.</p>
<p>I don&#8217;t want to give too much away, but it&#8217;s loads of fun and it&#8217;s free.  Download it now and have some fun with your friends!</p>
<p><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=305450679&#038;mt=8">Free Download here.</a></p>
<p>-Spicy</p>
]]></content:encoded>
			<wfw:commentRss>http://thespicychicken.com/2009/03/14/trick-your-friends/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PopBalloons and making Demonstration Videos</title>
		<link>http://thespicychicken.com/2009/03/08/demonstration-videos/</link>
		<comments>http://thespicychicken.com/2009/03/08/demonstration-videos/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 19:13:48 +0000</pubDate>
		<dc:creator>Spicy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[videos]]></category>

		<guid isPermaLink="false">http://thespicychicken.com/?p=93</guid>
		<description><![CDATA[Background While learning how to use the microphone on the iPhone to record I thought a quick and fun iPhone Game which leverages the microphone on the phone. There&#8217;s lots of apps out there that take advantage of the accelerometers, but not too many that use the microphone as a control device.  In PopBalloons you [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Background</strong></p>
<p>While learning how to use the microphone on the iPhone to record I thought a quick and fun iPhone Game which leverages the microphone on the phone.</p>
<p>There&#8217;s lots of apps out there that take advantage of the accelerometers, but not too many that use the microphone as a control device.  In PopBalloons you control a laser that floats around the screen (using the accelerometers, of course <img src='http://thespicychicken.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , but to fire the laser you need to make a sound.  A snap, a click, sing a song, whatever.  The intensity of the laser is directly proportional to the intensity of the sound that the iPhone hears.  You can even slightly tap the microphone with your finger, if you really need to be quiet.</p>
<p>As an added bonus, I cartooned up some LOL cats, and instead of popping balloons with your sound-laser, you can pop LOL-CATS!  I know, it&#8217;s brilliant. More information on PopBalloons, and all of my future mobile phone apps can be found at the website of my new company, <a href="http://mophilia.com">Mophilia, Inc</a>.</p>
<p><strong>Demonstration Videos</strong></p>
<p>The real point to this post is to demonstrate how to make a crude demonstration video of a live-action game.  My first thought was to take screenshots using the screen shot function and then string them into a video.</p>
<div class="code">CGImageRef screen = UIGetScreenImage();<br />
UIImage *viewImage = [UIImage imageWithCGImage:screen];<br />
CGImageRelease(screen);</div>
<p>However, the process of getting the screen shot and saving it takes way to long and eats up too much memory to be run at full speed.  So it occurred to me, that since the game is being triggered by timers which are on the order of 30fps then I could slow the game down and take screenshots between the frames.  For example, if I slowed the entire gameplay down to 10fps then I could take screenshots at that rate and not run into memory issues. So in my PopBalloons_Prefix.pch file I have this:</p>
<div class="code">// This is the master Timer update frequency.  Normal speed is 30.<br />
#define PopBalloonsMasterFrequency 10</div>
<p>All of the rest of the frequencies are based on this one.  So if I have a timer that normally runs at 20fps I would simply redefine the frequency like this:</p>
<div class="code">// Nomal update frequency is 20 Hz<br />
#define kUpdateFrequency ((2./3.)*PopBalloonsMasterFrequency)</div>
<p>Now I can arbitrarily slow down my entire game so that I can do CPU and memory taxing procedures.  In case you are interested I save the images to file using:</p>
<div class="code">NSData *imgData = UIImagePNGRepresentation(viewImage);<br />
if (![imgData writeToFile:filePath atomically:NO]) {<br />
NSLog(@&#8221;Failed to write the image data to file.&#8221;);<br />
}</div>
<p>Where filePath is an NSString object that contains the full path to the destination file and viewImage is a UIImage object from the code above.</p>
<p><strong>Encoding the PNG files into a Video</strong></p>
<p>Now that I have a whole bunch of images I need to encode them into a movie. I use mencoder to do this. Mencoder comes with MPlayer which can be installed using Darwin Ports.</p>
<div class="code">#port install MPlayer</div>
<p>Note you need to have /opt/local/bin set in your PATH file.</p>
<p>I wanted the video to include an image of the phone, so it the game looks like it is being played.  To do so I just used Grab to take a screenshot of the simulator and saved that file as PhoneImage.png in the same directory as my screenshot files.  Now I can use some a handy python script to combine the images and generate what will be the frame for my video.</p>
<div class="code">import os<br />
from PIL import Image</p>
<p>phone_image_name = &#8216;PhoneImage.png&#8217;<br />
file_names = [f for f in os.listdir('.') if not os.isdir(f) and not f.split('_')[-1] == &#8216;done.png&#8217; and not f.split(&#8216;.&#8217;)[-1] == &#8216;py&#8217; and not f in [phone_image_name] and not f[0] == &#8216;.&#8217;]</p>
<p>for file_name in file_names:<br />
  phone_image = Image.open(phone_image_name)<br />
  im = Image.open(file_name)<br />
  phone_image.paste(im, (63,160))<br />
  phone_image.save(file_name.split(&#8216;.&#8217;)[0] + &#8216;_done.png&#8217;)
</p></div>
<p>After the images are converted I just delete all the old files and then string them together to make a video using mencoder:</p>
<div class="code">mencoder &#8220;mf://*.png&#8221; -mf type=png:w=320:h=480:fps=28 -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o foo.avi</div>
<p>The product of this is the following video:</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/MFKv1cFQsY8&#038;hl=en&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/MFKv1cFQsY8&#038;hl=en&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>As you can see it&#8217;s far from perfect.  It&#8217;s a little shaky and you can see the flicker of the text prompt in the Text Field, but as a first pass it will do.</p>
<p>-Spicy</p>
]]></content:encoded>
			<wfw:commentRss>http://thespicychicken.com/2009/03/08/demonstration-videos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In the works.</title>
		<link>http://thespicychicken.com/2009/03/08/in-the-works/</link>
		<comments>http://thespicychicken.com/2009/03/08/in-the-works/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 18:14:43 +0000</pubDate>
		<dc:creator>Spicy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://thespicychicken.com/2009/03/08/in-the-works/</guid>
		<description><![CDATA[The reason I haven&#8217;t posted in a while is that there are BIG things in the pipeline, that I am dying to tell you about&#8230;just not yet. Stay tuned!]]></description>
			<content:encoded><![CDATA[<p>The reason I haven&#8217;t posted in a while is that there are BIG things in the pipeline, that I am dying to tell you about&#8230;just not yet.</p>
<p>Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://thespicychicken.com/2009/03/08/in-the-works/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Pulse v1.1 Released</title>
		<link>http://thespicychicken.com/2009/02/05/the-pulse-v11-released/</link>
		<comments>http://thespicychicken.com/2009/02/05/the-pulse-v11-released/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 23:40:19 +0000</pubDate>
		<dc:creator>Spicy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[app news]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[pulse]]></category>

		<guid isPermaLink="false">http://thespicychicken.com/?p=80</guid>
		<description><![CDATA[I have received some really good feedback about my first &#8216;official&#8217; iphone application, The Pulse.  Users have really liked the app, but it seem to lack some basic features.  In version 1.1 the ability to pause the onslaught of incoming news articles as well as in-app web viewing has been added. Most importantly, here are [...]]]></description>
			<content:encoded><![CDATA[<p>I have received some really good feedback about my first &#8216;official&#8217; iphone application, The Pulse.  Users have really liked the app, but it seem to lack some basic features.  In version 1.1 the ability to pause the onslaught of incoming news articles as well as in-app web viewing has been added.</p>
<p>Most importantly, here are some screenshots:</p>
<p><img class="alignnone size-full wp-image-82" title="img_0028" src="http://thespicychicken.com/wp-content/uploads/2009/02/img_0028.png" alt="img_0028" width="320" height="480" /> <img class="alignnone size-full wp-image-83" title="img_0031" src="http://thespicychicken.com/wp-content/uploads/2009/02/img_0031.png" alt="img_0031" width="320" height="480" /></p>
<p>You can download the app from:</p>
<p><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=301786228&amp;mt=8">http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=301786228&amp;mt=8</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thespicychicken.com/2009/02/05/the-pulse-v11-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First &#8220;official&#8221; iPhone App</title>
		<link>http://thespicychicken.com/2009/01/23/first-official-iphone-app/</link>
		<comments>http://thespicychicken.com/2009/01/23/first-official-iphone-app/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 01:39:31 +0000</pubDate>
		<dc:creator>Spicy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[pulse]]></category>

		<guid isPermaLink="false">http://thespicychicken.com/?p=69</guid>
		<description><![CDATA[Hi all, As I mentioned earlier, my first official iPhone application has come out.  It&#8217;s called The Pulse and is great for killing some extra time.  Keep an eye on the latest from your favorite news sites.  You can download it for free here: http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=301786228&#38;mt=8 If you like it and would like to see more [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,</p>
<p>As I mentioned earlier, my first official iPhone application has come out.  It&#8217;s called The Pulse and is great for killing some extra time.  Keep an eye on the latest from your favorite news sites.  You can download it for free here:</p>
<p><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=301786228&#038;mt=8">http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=301786228&amp;mt=8</a></p>
<p>If you like it and would like to see more features shoot me an email.  If there is interest I&#8217;ll expand on the app.</p>
<p>Best,<br />
Spicy</p>
]]></content:encoded>
			<wfw:commentRss>http://thespicychicken.com/2009/01/23/first-official-iphone-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

