<?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>Cerebral Mastication &#187; graph</title>
	<atom:link href="http://www.cerebralmastication.com/tag/graph/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cerebralmastication.com</link>
	<description>Something to Chew On</description>
	<lastBuildDate>Fri, 16 Jul 2010 22:07:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Not Just Normal&#8230; Gaussian</title>
		<link>http://www.cerebralmastication.com/2009/06/not-just-normal-gaussian/</link>
		<comments>http://www.cerebralmastication.com/2009/06/not-just-normal-gaussian/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 16:26:46 +0000</pubDate>
		<dc:creator>JD Long</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://www.cerebralmastication.com/?p=296</guid>
		<description><![CDATA[Dave, over at The Revolutions Blog, posted about the big &#8216;ol list of graphs created with R that are over at Wikimedia Commons. As I was scrolling through the list I recognized the standard normal distribution from the Wikipedia article on the same topic.
Below is the fairly simple source code with lots of comments. Here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 198px"><a href="http://en.wikipedia.org/wiki/Normal_distribution#Standard_deviation_and_confidence_intervals" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Normal_distribution_Standard_deviation_and_confidence_intervals?referer=');"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/8/8c/Standard_deviation_diagram.svg/325px-Standard_deviation_diagram.svg.png" alt="Pretty Normal" width="188" height="94" /></a><p class="wp-caption-text">Pretty Normal</p></div>
<p>Dave, over at The Revolutions Blog,<a href="http://blog.revolution-computing.com/2009/06/graphs-created-with-r-on-wikimedia-commons.html" onclick="pageTracker._trackPageview('/outgoing/blog.revolution-computing.com/2009/06/graphs-created-with-r-on-wikimedia-commons.html?referer=');"> posted about the big &#8216;ol list of graphs</a> created with R that are over at <a href="http://commons.wikimedia.org/wiki/Category:Created_with_R" onclick="pageTracker._trackPageview('/outgoing/commons.wikimedia.org/wiki/Category_Created_with_R?referer=');">Wikimedia Commons</a>. As I was scrolling through the list I recognized the standard normal distribution from the <a href="http://en.wikipedia.org/wiki/Normal_distribution#Standard_deviation_and_confidence_intervals" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Normal_distribution_Standard_deviation_and_confidence_intervals?referer=');">Wikipedia article on the same topic</a>.</p>
<p>Below is the fairly simple source code with lots of comments. <a href="http://commons.wikimedia.org/wiki/File:Standard_deviation_diagram.svg" onclick="pageTracker._trackPageview('/outgoing/commons.wikimedia.org/wiki/File_Standard_deviation_diagram.svg?referer=');">Here&#8217;s the source</a>. Run it at home&#8230; for fun and profit.</p>
<blockquote>
<pre># # External package to generate four shades of blue
# library(RColorBrewer)
# cols &lt;- rev(brewer.pal(4, "Blues"))
cols &lt;- c("#2171B5", "#6BAED6", "#BDD7E7", "#EFF3FF")

# Sequence between -4 and 4 with 0.1 steps
x &lt;- seq(-4, 4, 0.1)

# Plot an empty chart with tight axis boundaries, and axis lines on bottom and left
plot(x, type="n", xaxs="i", yaxs="i", xlim=c(-4, 4), ylim=c(0, 0.4),
     bty="l", xaxt="n", xlab="x-value", ylab="probability density")

# Function to plot each coloured portion of the curve, between "a" and "b" as a
# polygon; the function "dnorm" is the normal probability density function
polysection &lt;- function(a, b, col, n=11){
    dx &lt;- seq(a, b, length.out=n)
    polygon(c(a, dx, b), c(0, dnorm(dx), 0), col=col, border=NA)
    # draw a white vertical line on "inside" side to separate each section
    segments(a, 0, a, dnorm(a), col="white")
}

# Build the four left and right portions of this bell curve
for(i in 0:3){
    polysection(   i, i+1,  col=cols[i+1]) # Right side of 0
    polysection(-i-1,  -i,  col=cols[i+1]) # Left right of 0
}

# Black outline of bell curve
lines(x, dnorm(x))

# Bottom axis values, where sigma represents standard deviation and mu is the mean
axis(1, at=-3:3, labels=expression(-3*sigma, -2*sigma, -1*sigma, mu,
                                    1*sigma,  2*sigma,  3*sigma))

# Add percent densities to each division, between x and x+1
pd &lt;- sprintf("%.1f%%", 100*(pnorm(1:4) - pnorm(0:3)))
text(c((0:3)+0.5,(0:-3)-0.5), c(0.16, 0.05, 0.04, 0.02), pd, col=c("white","white","black","black"))
segments(c(-2.5, -3.5, 2.5, 3.5), dnorm(c(2.5, 3.5)), c(-2.5, -3.5, 2.5, 3.5), c(0.03, 0.01))</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.cerebralmastication.com/2009/06/not-just-normal-gaussian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
