<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Bayesian Thinking</title>
	<atom:link href="http://learnbayes.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://learnbayes.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Tue, 06 Dec 2011 20:04:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='learnbayes.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Bayesian Thinking</title>
		<link>http://learnbayes.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://learnbayes.wordpress.com/osd.xml" title="Bayesian Thinking" />
	<atom:link rel='hub' href='http://learnbayes.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Graphical elicitation of a beta prior</title>
		<link>http://learnbayes.wordpress.com/2011/12/06/graphical-elicitation-of-a-beta-prior/</link>
		<comments>http://learnbayes.wordpress.com/2011/12/06/graphical-elicitation-of-a-beta-prior/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 20:04:54 +0000</pubDate>
		<dc:creator>bayesball</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://learnbayes.wordpress.com/?p=463</guid>
		<description><![CDATA[My students are doing a project where they have to elicit a beta prior for a proportion.  This is a difficult task and any tools to make this process a little easier are helpful. I&#8217;ve been playing with a R package manipulate that is included as part of the RStudio installation (for those who don&#8217;t [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=463&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My students are doing a project where they have to elicit a beta prior for a proportion.  This is a difficult task and any tools to make this process a little easier are helpful.</p>
<p>I&#8217;ve been playing with a R package manipulate that is included as part of the RStudio installation (for those who don&#8217;t know, RStudio is a nice interface for R).  This package makes it easy to construct sliders, push buttons, and pull-down menus to provide a nice user interface for functions one creates.</p>
<p>Here is a simple illustration of the use of the manipulate package.  One assesses the shape parameters of the beta indirectly by specifying (1) the prior median p.med and (2) the prior 90th percentile p.90.   One inputs values of p.med and p.90 by sliders and you see the beta density curve that matches this information.  I wrote a simple R script that constructs the graph with sliders &#8212; the main tools are the manipulate package and the LearnBayes package (the beta.select function).</p>
<p>Here is the <a href="http://personal.bgsu.edu/~albert/MATH6480/R/beta.select.manipulate1.R">scrip</a>t and <a href="http://screencast.com/t/uKqQHsiIzOa9">here</a> is a movie that shows the sliders in action.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learnbayes.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learnbayes.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learnbayes.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learnbayes.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learnbayes.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learnbayes.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learnbayes.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learnbayes.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learnbayes.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learnbayes.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learnbayes.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learnbayes.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learnbayes.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learnbayes.wordpress.com/463/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=463&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learnbayes.wordpress.com/2011/12/06/graphical-elicitation-of-a-beta-prior/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e40b14d1e48f8189f4d7d012481145b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bayesball</media:title>
		</media:content>
	</item>
		<item>
		<title>Three Sampling Models for Fire Calls</title>
		<link>http://learnbayes.wordpress.com/2011/10/31/three-sampling-models-for-fire-calls/</link>
		<comments>http://learnbayes.wordpress.com/2011/10/31/three-sampling-models-for-fire-calls/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 23:47:31 +0000</pubDate>
		<dc:creator>bayesball</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://learnbayes.wordpress.com/?p=456</guid>
		<description><![CDATA[Continuing our example, suppose our prior beliefs about the mean count of fire calls is Gamma(280, 4).  (Essentially this says that our prior guess at is 70 and the prior standard deviation is about 4.2.)  But we&#8217;re unsure about the sampling model &#8212; it could be (M1) exponential(), (M2) Poisson(), or (M3) normal with mean [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=456&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Continuing our example, suppose our prior beliefs about the mean count of fire calls <img src='http://s0.wp.com/latex.php?latex=%5Ctheta&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;theta' title='&#92;theta' class='latex' /> is Gamma(280, 4).  (Essentially this says that our prior guess at <img src='http://s0.wp.com/latex.php?latex=%5Ctheta&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;theta' title='&#92;theta' class='latex' /> is 70 and the prior standard deviation is about 4.2.)  But we&#8217;re unsure about the sampling model &#8212; it could be (M1) exponential(<img src='http://s0.wp.com/latex.php?latex=%5Ctheta&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;theta' title='&#92;theta' class='latex' />), (M2) Poisson(<img src='http://s0.wp.com/latex.php?latex=%5Ctheta&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;theta' title='&#92;theta' class='latex' />), or (M3) normal with mean <img src='http://s0.wp.com/latex.php?latex=%5Ctheta&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;theta' title='&#92;theta' class='latex' /> and standard deviation 12.</p>
<p>To get some sense about the best sampling model, I&#8217;ve plotted a histogram of the fire call counts below.  I&#8217;ve overlaid fitted exponential, Poisson, and normal distributions where I estimate <img src='http://s0.wp.com/latex.php?latex=%5Ctheta&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;theta' title='&#92;theta' class='latex' /> by the sample mean.</p>
<p>I think it is pretty clear from the graph that the exponential model is a poor fit.  The fits of the Poisson and normal (sd = 12) models are similar, although I&#8217;d give a slight preference to the normal model.</p>
<p>For each model, I compute the logarithm of the predictive probability <img src='http://s0.wp.com/latex.php?latex=f%28y%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='f(y)' title='f(y)' class='latex' />.   (I wrote a short function defining the log posterior of <img src='http://s0.wp.com/latex.php?latex=%5Ctheta&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;theta' title='&#92;theta' class='latex' /> and then used the laplace function in the LearnBayes package to compute <img src='http://s0.wp.com/latex.php?latex=%5Clog+f%28y%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;log f(y)' title='&#92;log f(y)' class='latex' />.)</p>
<p>Here are the results:</p>
<p>Model     <img src='http://s0.wp.com/latex.php?latex=%5Clog+f%28y%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;log f(y)' title='&#92;log f(y)' class='latex' /><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Poisson              -148.0368<br />
exponential        -194.3483<br />
normal(12)        -144.3027<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>The exponential model is a clear loser and the Poisson and normal(12) models are close.  The Bayes factor in support of the normal(12) model is</p>
<p><img src='http://s0.wp.com/latex.php?latex=BF_%7BNP%7D+%3D+%5Cexp%28+-144.3037+%2B+148.0368+%29+%3D+41.8&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='BF_{NP} = &#92;exp( -144.3037 + 148.0368 ) = 41.8' title='BF_{NP} = &#92;exp( -144.3037 + 148.0368 ) = 41.8' class='latex' /></p>
<p><a href="http://learnbayes.files.wordpress.com/2011/10/rplot01.png"><img class="alignleft size-full wp-image-458" title="Rplot01" src="http://learnbayes.files.wordpress.com/2011/10/rplot01.png?w=535&#038;h=437" alt="" width="535" height="437" /></a></p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learnbayes.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learnbayes.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learnbayes.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learnbayes.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learnbayes.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learnbayes.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learnbayes.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learnbayes.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learnbayes.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learnbayes.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learnbayes.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learnbayes.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learnbayes.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learnbayes.wordpress.com/456/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=456&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learnbayes.wordpress.com/2011/10/31/three-sampling-models-for-fire-calls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e40b14d1e48f8189f4d7d012481145b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bayesball</media:title>
		</media:content>

		<media:content url="http://learnbayes.files.wordpress.com/2011/10/rplot01.png" medium="image">
			<media:title type="html">Rplot01</media:title>
		</media:content>
	</item>
		<item>
		<title>Modeling fire alarm counts</title>
		<link>http://learnbayes.wordpress.com/2011/10/30/modeling-fire-alarm-counts/</link>
		<comments>http://learnbayes.wordpress.com/2011/10/30/modeling-fire-alarm-counts/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 23:37:03 +0000</pubDate>
		<dc:creator>bayesball</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://learnbayes.wordpress.com/?p=448</guid>
		<description><![CDATA[Sorry for the long delay since my last post.  It seems that one needs to keep a regular posting pattern, say several days a week. to keep this blog active. We&#8217;re now talking about comparing models by Bayes factors.  To motivate the discussion of plausible models, I found the following website that gives the number [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=448&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sorry for the long delay since my last post.  It seems that one needs to keep a regular posting pattern, say several days a week. to keep this blog active.</p>
<p>We&#8217;re now talking about comparing models by Bayes factors.  To motivate the discussion of plausible models, I found the following <a href="http://www.franklinvillefire.org/callstatistics.htm">website</a> that gives the number of fire calls for each month in Franklinville, NC for the last several years.</p>
<p>Suppose we observe the fire call counts <img src='http://s0.wp.com/latex.php?latex=y_1%2C+...%2C+y_N&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='y_1, ..., y_N' title='y_1, ..., y_N' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=N&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='N' title='N' class='latex' /> consecutive months.  Here is a general model for these data.</p>
<ol>
<li><img src='http://s0.wp.com/latex.php?latex=y_1%2C+...%2C+y_N&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='y_1, ..., y_N' title='y_1, ..., y_N' class='latex' /> are independent <img src='http://s0.wp.com/latex.php?latex=f%28y+%7C+%5Ctheta%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='f(y | &#92;theta)' title='f(y | &#92;theta)' class='latex' /></li>
<li><img src='http://s0.wp.com/latex.php?latex=%5Ctheta&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;theta' title='&#92;theta' class='latex' /> has a prior <img src='http://s0.wp.com/latex.php?latex=g%28%5Ctheta%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='g(&#92;theta)' title='g(&#92;theta)' class='latex' /></li>
</ol>
<div>Also, suppose we have some prior beliefs about the mean fire count <img src='http://s0.wp.com/latex.php?latex=E%28y%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='E(y)' title='E(y)' class='latex' />.  We believe that this mean is about 70 and the standard deviation of this guess is 10.</div>
<div>Given this general model structure, we have to think of possible choices for <img src='http://s0.wp.com/latex.php?latex=f&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='f' title='f' class='latex' />, the sampling density.  We think of the popular distributions, say Poisson, normal, exponential, etc.  Also we should think about different choices for the prior density.   For the prior, there are many possible choices &#8212; we typically choose one that can represent my prior information.</div>
<div>Once we decide on several plausible choices of sampling density and prior, then we&#8217;ll compare the models by Bayes factors.  To do this, we compute the prior predictive density of the actual data for each possible model.  It is very convenient to perform this calculation for discrete models (where the parameter <img src='http://s0.wp.com/latex.php?latex=%5Ctheta&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;theta' title='&#92;theta' class='latex' /> is discrete) and we&#8217;ll first illustrate Bayes factor computations in this special case</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learnbayes.wordpress.com/448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learnbayes.wordpress.com/448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learnbayes.wordpress.com/448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learnbayes.wordpress.com/448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learnbayes.wordpress.com/448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learnbayes.wordpress.com/448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learnbayes.wordpress.com/448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learnbayes.wordpress.com/448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learnbayes.wordpress.com/448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learnbayes.wordpress.com/448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learnbayes.wordpress.com/448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learnbayes.wordpress.com/448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learnbayes.wordpress.com/448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learnbayes.wordpress.com/448/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=448&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learnbayes.wordpress.com/2011/10/30/modeling-fire-alarm-counts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e40b14d1e48f8189f4d7d012481145b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bayesball</media:title>
		</media:content>
	</item>
		<item>
		<title>Cell phone story &#8212; part 3</title>
		<link>http://learnbayes.wordpress.com/2011/10/05/cell-phone-story-part-3/</link>
		<comments>http://learnbayes.wordpress.com/2011/10/05/cell-phone-story-part-3/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 13:47:57 +0000</pubDate>
		<dc:creator>bayesball</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://learnbayes.wordpress.com/?p=443</guid>
		<description><![CDATA[After talking about this problem in class on Monday, I realized that we don&#8217;t understand the texting patterns of undergraduates very well.  So I&#8217;m reluctant to specify an informative prior in this situation for the simple reason that I don&#8217;t understand this that well.  So I&#8217;m going to illustrate using bugs to fit this model [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=443&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After talking about this problem in class on Monday, I realized that we don&#8217;t understand the texting patterns of undergraduates very well.  So I&#8217;m reluctant to specify an informative prior in this situation for the simple reason that I don&#8217;t understand this that well.  So I&#8217;m going to illustrate using bugs to fit this model using a vague prior.</p>
<p>I have observed the number of text messages for my son for 16 days in this months billing period.  Since his monthly allocation is 5000 messages, I am focusing on the event &#8220;number of messages in the 30 days exceeds 5000.&#8221;  Currently my son has had 3314 messages and so I&#8217;m interested in computing the predictive probability that the number of messages in the remaining 14 days exceeds 1686.</p>
<p>Here I&#8217;ll outline using the openbugs software with the R interface in the BRugs package to fit our model.</p>
<p>I&#8217;m assuming that you&#8217;re on a Windows machine and have already installed the BRugs package in R.</p>
<p>First we write a script that describes the normal sampling model.  Following Kruschke&#8217;s <a href="http://www.indiana.edu/%7Ekruschke/DoingBayesianDataAnalysis/">Doing Bayesian Data Analysis</a> text, I can enter this model into the R console and write it to a file model.txt.</p>
<p>modelString = &#8220;<br />
model {<br />
for( i in 1:n ){<br />
y[i] ~ dnorm( mu, P )<br />
}<br />
mu ~ dnorm( mu0, P0 )<br />
mu0 &lt;- 100<br />
P0 &lt;- 0.00001<br />
P ~ dgamma(a, b)<br />
a &lt;- 0.001<br />
b &lt;- 0.001<br />
}<br />
&#8220;<br />
writeLines(modelString, con=&#8221;model.txt&#8221;)</p>
<p># We load in the BRugs package (this includes the openbugs software).</p>
<p>library(BRugs)</p>
<p># Set up the initial values for <img src='http://s0.wp.com/latex.php?latex=%5Cmu&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu' title='&#92;mu' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=P&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='P' title='P' class='latex' /> in the MCMC iteration &#8212; this puts the values in a file called inits.txt.</p>
<p>bugsInits(list(c(mu = 200, P = 0.05)),<br />
numChains = 1, fileName = &#8220;inits.txt&#8221;)</p>
<p># Have openbugs check that the model specification is okay.</p>
<p>modelCheck(&#8220;model.txt&#8221;)</p>
<p># Here is our data &#8212; n is the number of observations and y is the vector of text message counts.</p>
<p>dataList = list(<br />
n = 16,<br />
y=c(207, 121, 144, 229, 113, 262, 169, 330,<br />
168, 132, 224, 188, 231, 207, 268, 321)<br />
)</p>
<p># Enter the data into openbugs.</p>
<p>modelData( bugsData( dataList ))</p>
<p># Compile the model.</p>
<p>modelCompile()</p>
<p># Read in the initial values for the simulation.</p>
<p>modelInits(&#8220;inits.txt&#8221;)</p>
<p># We are going to monitor the mean and the precision.</p>
<p>samplesSet( c(&#8220;mu&#8221;, &#8220;P&#8221;))</p>
<p># We&#8217;ll try 10,000 iterations of MCMC.</p>
<p>chainLength = 10000</p>
<p># Update (actually run the MCMC) &#8212; it is very quick.</p>
<p>modelUpdate( chainLength )</p>
<p># The function samplesSample collects the simulated draws, samplesStats computes summary statistics.</p>
<p>muSample = samplesSample( &#8220;mu&#8221;)<br />
muSummary = samplesStats( &#8220;mu&#8221;)</p>
<p>PSample = samplesSample( &#8220;P&#8221;)<br />
PSummary = samplesStats( &#8220;P&#8221;)</p>
<p># From this output, we can compute summaries of any function of the parameters of interest (like the normal standard deviation) and compute the predictive probability of interest.</p>
<p>Let&#8217;s focus on the prediction problem.  The variable of interest is z, the number of text messages in the 14 remaining days in the month.  The sampling model assumes that the number of daily text messages is N(<img src='http://s0.wp.com/latex.php?latex=%5Cmu%2C+%5Csigma&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu, &#92;sigma' title='&#92;mu, &#92;sigma' class='latex' />), so the sum of text messages for 14 games is N(<img src='http://s0.wp.com/latex.php?latex=14+%5Cmu%2C+%5Csqrt%7B14%7D+%5Csigma%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='14 &#92;mu, &#92;sqrt{14} &#92;sigma)' title='14 &#92;mu, &#92;sqrt{14} &#92;sigma)' class='latex' />.</p>
<p>To simulate a single value of z from the posterior predictive distribution, we (1) simulate a value of <img src='http://s0.wp.com/latex.php?latex=%28%5Cmu%2C+%5Csigma%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='(&#92;mu, &#92;sigma)' title='(&#92;mu, &#92;sigma)' class='latex' /> from its posterior distribution, and (2) simulate z from a normal distribution using these simulated draws as parameters.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learnbayes.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learnbayes.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learnbayes.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learnbayes.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learnbayes.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learnbayes.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learnbayes.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learnbayes.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learnbayes.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learnbayes.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learnbayes.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learnbayes.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learnbayes.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learnbayes.wordpress.com/443/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=443&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learnbayes.wordpress.com/2011/10/05/cell-phone-story-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e40b14d1e48f8189f4d7d012481145b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bayesball</media:title>
		</media:content>
	</item>
		<item>
		<title>Cell phone story &#8212; part 2</title>
		<link>http://learnbayes.wordpress.com/2011/10/03/cell-phone-story-part-2/</link>
		<comments>http://learnbayes.wordpress.com/2011/10/03/cell-phone-story-part-2/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 17:46:30 +0000</pubDate>
		<dc:creator>bayesball</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://learnbayes.wordpress.com/?p=434</guid>
		<description><![CDATA[It is relatively easy to set up a Gibbs sampling algorithm for the normal sampling problem when independent priors (of the conjugate type) are assigned to the mean and precision.  Here we outline how to do this on R. We start with an expression for the joint posterior of the mean and the precision : [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=434&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It is relatively easy to set up a Gibbs sampling algorithm for the normal sampling problem when independent priors (of the conjugate type) are assigned to the mean and precision.  Here we outline how to do this on R.</p>
<p>We start with an expression for the joint posterior of the mean <img src='http://s0.wp.com/latex.php?latex=%5Cmu&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu' title='&#92;mu' class='latex' /> and the precision <img src='http://s0.wp.com/latex.php?latex=P&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='P' title='P' class='latex' />:</p>
<p><a href="http://learnbayes.files.wordpress.com/2011/10/formula.jpg"><img class="alignleft size-full wp-image-439" title="formula" src="http://learnbayes.files.wordpress.com/2011/10/formula.jpg?w=535" alt=""   /></a></p>
<p>(Here S is the sum of squares of the observations about the mean.)</p>
<p>1.  To start, we recognize the two conditional distributions.</p>
<ul>
<li>The posterior of <img src='http://s0.wp.com/latex.php?latex=%5Cmu&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu' title='&#92;mu' class='latex' /> given <img src='http://s0.wp.com/latex.php?latex=P&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='P' title='P' class='latex' /> is given by the usual updating formula for a normal mean and a normal prior.  (Essentially this formula says that the posterior precision is the sum of the prior and data precisions and the posterior mean is a weighted average of the prior mean and the sample mean where the weights are proportional to the corresponding precisions.</li>
<li>The posterior of <img src='http://s0.wp.com/latex.php?latex=P&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='P' title='P' class='latex' /> given <img src='http://s0.wp.com/latex.php?latex=%5Cmu&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu' title='&#92;mu' class='latex' /> has a gamma form where the shape is given by <img src='http://s0.wp.com/latex.php?latex=a+%2B+n%2F2&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='a + n/2' title='a + n/2' class='latex' /> and the scale is easy to pick up.</li>
</ul>
<p>2.  Now we&#8217;re ready to use R.  I&#8217;ve written a short function that implements a single Gibbs sampling cycle.  To understand the code, here are the variables:</p>
<p>- ybar is the sample mean, S is the sum of squares about the mean, and n is the sample size<br />
- the prior parameters are (mu0, tau) for the prior and (a, b) for the precision<br />
- theta is the current value of (<img src='http://s0.wp.com/latex.php?latex=%5Cmu%2C+P&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu, P' title='&#92;mu, P' class='latex' />)</p>
<p>The function performs the simulations from the distributions [<img src='http://s0.wp.com/latex.php?latex=%5Cmu+%7C+P&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu | P' title='&#92;mu | P' class='latex' />] and <img src='http://s0.wp.com/latex.php?latex=P+%7C+%5Cmu%5D&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='P | &#92;mu]' title='P | &#92;mu]' class='latex' /> and returns a new value of (<img src='http://s0.wp.com/latex.php?latex=%5Cmu%2C+P&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu, P' title='&#92;mu, P' class='latex' />)</p>
<p><code>one.cycle=function(theta){<br />
mu = theta[1]; P = theta[2]<br />
P1 = 1/tau0^2 + n*P<br />
mu1 = (mu0/tau0^2 + ybar*n*P) / P1<br />
tau1 = sqrt(1/P1)<br />
mu = rnorm(1, mu1, tau1)</code></p>
<p>a1 = a + n/2<br />
b1 = b + S/2 + n/2*(mu &#8211; ybar)^2<br />
P = rgamma(1, a1, b1)<br />
c(mu, P)<br />
}</p>
<p>All there is left in the programming is some set up code (bring in the data and define the prior parameters), give a starting value, and collect the vectors of simulated draws in a matrix.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learnbayes.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learnbayes.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learnbayes.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learnbayes.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learnbayes.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learnbayes.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learnbayes.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learnbayes.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learnbayes.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learnbayes.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learnbayes.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learnbayes.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learnbayes.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learnbayes.wordpress.com/434/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=434&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learnbayes.wordpress.com/2011/10/03/cell-phone-story-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e40b14d1e48f8189f4d7d012481145b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bayesball</media:title>
		</media:content>

		<media:content url="http://learnbayes.files.wordpress.com/2011/10/formula.jpg" medium="image">
			<media:title type="html">formula</media:title>
		</media:content>
	</item>
		<item>
		<title>Cell phone story</title>
		<link>http://learnbayes.wordpress.com/2011/10/02/cell-phone-story/</link>
		<comments>http://learnbayes.wordpress.com/2011/10/02/cell-phone-story/#comments</comments>
		<pubDate>Sun, 02 Oct 2011 16:46:53 +0000</pubDate>
		<dc:creator>bayesball</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://learnbayes.wordpress.com/?p=429</guid>
		<description><![CDATA[I&#8217;m interested in learning about the pattern of text message use for my college son.  I pay the monthly cell phone bill and I want to be pretty sure that he won&#8217;t exceed his monthly allowance of 5000 messages. We&#8217;ll put this problem in the context of a normal distribution inference problem.  Suppose , the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=429&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m interested in learning about the pattern of text message use for my college son.  I pay the monthly cell phone bill and I want to be pretty sure that he won&#8217;t exceed his monthly allowance of 5000 messages.</p>
<p>We&#8217;ll put this problem in the context of a normal distribution inference problem.  Suppose <img src='http://s0.wp.com/latex.php?latex=y&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='y' title='y' class='latex' />, the number of daily text messages (received and sent) is normal with mean <img src='http://s0.wp.com/latex.php?latex=%5Cmu&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu' title='&#92;mu' class='latex' /> and standard deviation <img src='http://s0.wp.com/latex.php?latex=%5Csigma&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;sigma' title='&#92;sigma' class='latex' />.  We&#8217;ll observe <img src='http://s0.wp.com/latex.php?latex=y_1%2C+...%2C+y_%7B13%7D&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='y_1, ..., y_{13}' title='y_1, ..., y_{13}' class='latex' />, the number of text messages in the first 13 days in the billing month.  I&#8217;m interested in the predictive probability that the total of the count of text message in the next 17 days exceeds 5000.</p>
<p>We&#8217;ll talk about this problem in three steps.</p>
<ol>
<li>First I talk about some prior beliefs about <img src='http://s0.wp.com/latex.php?latex=%28%5Cmu%2C+%5Csigma%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='(&#92;mu, &#92;sigma)' title='(&#92;mu, &#92;sigma)' class='latex' /> that we&#8217;ll model by independent conjugate priors.</li>
<li> I&#8217;ll discuss the use of Gibbs sampling to simulate from the posterior distribution.</li>
<li>Last, we&#8217;ll use the output of the Gibbs sampler to get a prediction interval for the sum of text messages in the next 17 days.</li>
</ol>
<div>Here we talk about prior beliefs.  To be honest, I didn&#8217;t think too long about my beliefs about my son&#8217;s text message usage, but here is what I have.</div>
<div>
<ol>
<li>First I assume that my prior beliefs about the mean <img src='http://s0.wp.com/latex.php?latex=%5Cmu&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu' title='&#92;mu' class='latex' /> and standard deviation <img src='http://s0.wp.com/latex.php?latex=%5Csigma&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;sigma' title='&#92;sigma' class='latex' /> of the population of text messages are independent.  This seems reasonable, especially since it is easier to think about each parameter separately.</li>
<li>I&#8217;ll use conjugate priors to model beliefs about each parameter.  I believe my son makes, on average, 40 messages per day but I could easily be off by 15.  So I let <img src='http://s0.wp.com/latex.php?latex=%5Cmu+%5Csim+N%2840%2C+15%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu &#92;sim N(40, 15)' title='&#92;mu &#92;sim N(40, 15)' class='latex' />.</li>
<li>It is harder to think about my beliefs about the standard deviation <img src='http://s0.wp.com/latex.php?latex=%5Csigma&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;sigma' title='&#92;sigma' class='latex' /> of the text message population.   After some thought, I decide that my prior mean and standard deviation of <img src='http://s0.wp.com/latex.php?latex=%5Csigma&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;sigma' title='&#92;sigma' class='latex' /> are 5 and 2, respectively.  We&#8217;ll see shortly that it is convenient to model the precision <img src='http://s0.wp.com/latex.php?latex=P+%3D+1%2F%5Csigma%5E2&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='P = 1/&#92;sigma^2' title='P = 1/&#92;sigma^2' class='latex' /> by a <img src='http://s0.wp.com/latex.php?latex=gamma%28a%2C+b%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='gamma(a, b)' title='gamma(a, b)' class='latex' /> distribution.  It turns out that <img src='http://s0.wp.com/latex.php?latex=P+%5Csim+gamma%283%2C+60%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='P &#92;sim gamma(3, 60)' title='P &#92;sim gamma(3, 60)' class='latex' /> is a reasonable match to my prior information about <img src='http://s0.wp.com/latex.php?latex=%5Csigma&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;sigma' title='&#92;sigma' class='latex' />.</li>
</ol>
<div>In the next blog posting, I&#8217;ll illustrate writing a R script to implement the Gibbs sampling.</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learnbayes.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learnbayes.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learnbayes.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learnbayes.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learnbayes.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learnbayes.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learnbayes.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learnbayes.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learnbayes.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learnbayes.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learnbayes.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learnbayes.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learnbayes.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learnbayes.wordpress.com/429/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=429&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learnbayes.wordpress.com/2011/10/02/cell-phone-story/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e40b14d1e48f8189f4d7d012481145b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bayesball</media:title>
		</media:content>
	</item>
		<item>
		<title>Learning from the extremes &#8211; part 3</title>
		<link>http://learnbayes.wordpress.com/2011/09/29/learning-from-the-extremes-part-3/</link>
		<comments>http://learnbayes.wordpress.com/2011/09/29/learning-from-the-extremes-part-3/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 20:35:10 +0000</pubDate>
		<dc:creator>bayesball</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://learnbayes.wordpress.com/?p=422</guid>
		<description><![CDATA[Continuing our selected data example, suppose we want to fit our Bayesian model by using a MCMC algorithm.  As described in class, the Metropolis-Hastings random walk algorithm is a convenient MCMC algorithm for sampling from this posterior density.  Let&#8217;s walk through the steps of doing this using LearnBayes. 1.  As before, we write a function [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=422&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Continuing our selected data example, suppose we want to fit our Bayesian model by using a MCMC algorithm.  As described in class, the Metropolis-Hastings random walk algorithm is a convenient MCMC algorithm for sampling from this posterior density.  Let&#8217;s walk through the steps of doing this using LearnBayes.</p>
<p>1.  As before, we write a function minmaxpost that contains the definition of the log posterior.  (See an earlier post for this function.)</p>
<p>2.  To get some initial ideas about the location of (<img src='http://s0.wp.com/latex.php?latex=%5Cmu%2C+%5Clog+%5Csigma&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu, &#92;log &#92;sigma' title='&#92;mu, &#92;log &#92;sigma' class='latex' />), we use the laplace function to get an estimate at the mean and variance-covariance matrix.</p>
<pre>data=list(n=10, min=52, max=84)
library(LearnBayes)
fit = laplace(minmaxpost, c(70, 2), data)
mo = fit$mode
v = fit$var</pre>
<p>Here mo is a vector with the posterior mode and v is a matrix containing the associated var-cov matrix.</p>
<p>Now we are ready to use the rwmetrop function that implements the M-H random walk algorithm.  There are four inputs:  (1) the function defining the log posterior, (2) a list containing var, the estimated var-cov matrix, and scale, the M-H random walk scale constant, (3) the starting value in the Markov Chain simulation, (4) the number of iterations of the algorithm, and (5) any data and prior parameters used in the log posterior density.</p>
<p>Here we&#8217;ll use v as our estimated var-cov matrix, use a scale value of 3, start the simulation at <img src='http://s0.wp.com/latex.php?latex=%28%5Cmu%2C+%5Clog+%5Csigma%29+%3D+%2870%2C+2%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='(&#92;mu, &#92;log &#92;sigma) = (70, 2)' title='(&#92;mu, &#92;log &#92;sigma) = (70, 2)' class='latex' /> and try 10,000 iterations.</p>
<p>s = rwmetrop(minmaxpost, list(var=v, scale=3), c(70, 2), 10000, data)</p>
<p>I display the acceptance rate &#8212; here it is 19% which is a reasonable value.</p>
<pre>&gt; s$accept
[1] 0.1943</pre>
<p>Here we can display the contours of the exact posterior and overlay the simulated draws.</p>
<pre>mycontour(minmaxpost, c(45, 95, 1.5, 4), data,
          xlab=expression(mu), ylab=expression(paste("log ",sigma)))
points(s$par)
<a href="http://learnbayes.files.wordpress.com/2011/09/rplot011.png"><img class="alignleft size-full wp-image-423" title="Rplot01" src="http://learnbayes.files.wordpress.com/2011/09/rplot011.png?w=535&#038;h=437" alt="" width="535" height="437" /></a></pre>
<p>It seems like we have been successful in getting a good sample from this posterior distribution.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learnbayes.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learnbayes.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learnbayes.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learnbayes.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learnbayes.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learnbayes.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learnbayes.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learnbayes.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learnbayes.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learnbayes.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learnbayes.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learnbayes.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learnbayes.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learnbayes.wordpress.com/422/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=422&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learnbayes.wordpress.com/2011/09/29/learning-from-the-extremes-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e40b14d1e48f8189f4d7d012481145b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bayesball</media:title>
		</media:content>

		<media:content url="http://learnbayes.files.wordpress.com/2011/09/rplot011.png" medium="image">
			<media:title type="html">Rplot01</media:title>
		</media:content>
	</item>
		<item>
		<title>Learning from the extremes &#8211; part 2</title>
		<link>http://learnbayes.wordpress.com/2011/09/23/learning-from-the-extremes-part-2/</link>
		<comments>http://learnbayes.wordpress.com/2011/09/23/learning-from-the-extremes-part-2/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 13:33:48 +0000</pubDate>
		<dc:creator>bayesball</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://learnbayes.wordpress.com/?p=414</guid>
		<description><![CDATA[In the last post, I described a problem with selected data.  You observe speeds of  10 cards but only collect the minimum speed 52 and the maximum speed of 84.  We want to learn about the mean and standard deviation of the underlying normal distribution. We&#8217;ll work with the parameterization which will give us a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=414&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the last post, I described a problem with selected data.  You observe speeds of  10 cards but only collect the minimum speed 52 and the maximum speed of 84.  We want to learn about the mean and standard deviation of the underlying normal distribution.</p>
<p>We&#8217;ll work with the parameterization <img src='http://s0.wp.com/latex.php?latex=%28%5Cmu%2C+%5Clog+%5Csigma%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='(&#92;mu, &#92;log &#92;sigma)' title='(&#92;mu, &#92;log &#92;sigma)' class='latex' /> which will give us a better normal approximation.  A standard noninformative prior is uniform on  <img src='http://s0.wp.com/latex.php?latex=%28%5Cmu%2C+%5Clog+%5Csigma%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='(&#92;mu, &#92;log &#92;sigma)' title='(&#92;mu, &#92;log &#92;sigma)' class='latex' />.</p>
<p>1.  First I write a short function minmaxpost that computes the logarithm of the posterior density.  The arguments to this function are <img src='http://s0.wp.com/latex.php?latex=%5Ctheta+%3D+%28%5Cmu%2C+%5Clog+%5Csigma%29&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;theta = (&#92;mu, &#92;log &#92;sigma)' title='&#92;theta = (&#92;mu, &#92;log &#92;sigma)' class='latex' /> and data which is a list with components n, min, and max.  I&#8217;d recommend using the R functions pnorm and dnorm in computing the density &#8212; it saves typing errors.</p>
<pre>minmaxpost=function(theta, data){
  mu = theta[1]
  sigma = exp(theta[2])
  dnorm(data$min, mu, sigma, log=TRUE) +
    dnorm(data$max, mu, sigma, log=TRUE) +
    (data$n - 2)*log(pnorm(data$max, mu, sigma)-pnorm(data$min, mu, sigma))
}</pre>
<p>2.  Then I use the function laplace in the LearnBayes package to summarize this posterior.  The arguments to laplace are the name of the log posterior function, an initial estimate at <img src='http://s0.wp.com/latex.php?latex=%5Ctheta&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;theta' title='&#92;theta' class='latex' /> and the data that is used in the log posterior function.</p>
<pre>data=list(n=10, min=52, max=84)
library(LearnBayes)
fit = laplace(minmaxpost, c(70, 2), data)</pre>
<p>3.  The output of laplace includes mode, the posterior mode, and var, the corresponding estimate at the variance-covariance matrix.</p>
<pre>fit
$mode
[1] 67.999960  2.298369

$var
              [,1]          [,2]
[1,]  1.920690e+01 -1.900688e-06
[2,] -1.900688e-06  6.031533e-02</pre>
<p>4.  I demonstrate below that we obtain a pretty good approximation in this situation.   I use the mycontour function to display contours of the exact posterior and overlay the matching normal approximation using a second application of mycontour.</p>
<pre>mycontour(minmaxpost, c(45, 95, 1.5, 4), data,
          xlab=expression(mu), ylab=expression(paste("log ",sigma)))
mycontour(lbinorm, c(45, 95, 1.5, 4),
          list(m=fit$mode, v=fit$var), add=TRUE, col="red")
<a href="http://learnbayes.files.wordpress.com/2011/09/newplot.png"><img class="alignleft size-full wp-image-416" title="newplot" src="http://learnbayes.files.wordpress.com/2011/09/newplot.png?w=535&#038;h=437" alt="" width="535" height="437" /></a></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learnbayes.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learnbayes.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learnbayes.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learnbayes.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learnbayes.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learnbayes.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learnbayes.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learnbayes.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learnbayes.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learnbayes.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learnbayes.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learnbayes.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learnbayes.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learnbayes.wordpress.com/414/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=414&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learnbayes.wordpress.com/2011/09/23/learning-from-the-extremes-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e40b14d1e48f8189f4d7d012481145b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bayesball</media:title>
		</media:content>

		<media:content url="http://learnbayes.files.wordpress.com/2011/09/newplot.png" medium="image">
			<media:title type="html">newplot</media:title>
		</media:content>
	</item>
		<item>
		<title>Learning from the extremes</title>
		<link>http://learnbayes.wordpress.com/2011/09/22/learning-from-the-extremes/</link>
		<comments>http://learnbayes.wordpress.com/2011/09/22/learning-from-the-extremes/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 13:22:43 +0000</pubDate>
		<dc:creator>bayesball</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://learnbayes.wordpress.com/?p=410</guid>
		<description><![CDATA[Here is an interesting problem with &#8220;selected data&#8221;.  Suppose you are measuring the speeds of cars driving on an interstate.  You assume the speeds are normally distributed with mean and standard deviation .  You see 10 cars pass by and you only record the minimum and maximum speeds.  What have you learned about the normal [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=410&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is an interesting problem with &#8220;selected data&#8221;.  Suppose you are measuring the speeds of cars driving on an interstate.  You assume the speeds are normally distributed with mean <img src='http://s0.wp.com/latex.php?latex=%5Cmu&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu' title='&#92;mu' class='latex' /> and standard deviation <img src='http://s0.wp.com/latex.php?latex=%5Csigma&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;sigma' title='&#92;sigma' class='latex' />.  You see 10 cars pass by and you only record the minimum and maximum speeds.  What have you learned about the normal parameters?</p>
<p>First we&#8217;ll describe the construction of the likelihood function.  We&#8217;ll combine the likelihood with the standard noninformative prior for a mean and standard deviation.   Then we&#8217;ll illustrate the use of a normal approximation to learn about the parameters.</p>
<p>Here we focus on the construction of the likelihood.  Given values of the normal parameters, what is the probability of observing minimum = x and the maximum = y in a sample of size n?</p>
<p>Essentially we&#8217;re looking for the joint density of two order statistics which is a standard result.  Let f and F denote the density and cdf of a normal density with mean <img src='http://s0.wp.com/latex.php?latex=%5Cmu&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;mu' title='&#92;mu' class='latex' /> and standard deviation <img src='http://s0.wp.com/latex.php?latex=%5Csigma&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;sigma' title='&#92;sigma' class='latex' />.  Then the joint density of (x, y) is given by</p>
<p><img src='http://s0.wp.com/latex.php?latex=f%28x%2C+y+%7C+%5Cmu%2C+%5Csigma%29+%5Cpropto+f%28x%29+f%28y%29+%5BF%28y%29+-+F%28x%29%5D%5E%7Bn-2%7D%2C+x+%3C+y&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='f(x, y | &#92;mu, &#92;sigma) &#92;propto f(x) f(y) [F(y) - F(x)]^{n-2}, x &lt; y' title='f(x, y | &#92;mu, &#92;sigma) &#92;propto f(x) f(y) [F(y) - F(x)]^{n-2}, x &lt; y' class='latex' /></p>
<p>After we observe data, the likelihood is this sampling density viewed as function of the parameters.  Suppose we take a sample of size 10 and we observe x = 52, y = 84.  Then the likelihood is given by</p>
<p><img src='http://s0.wp.com/latex.php?latex=L%28%5Cmu%2C+%5Csigma%29+%5Cpropto+f%2852%29+f%2884%29+%5BF%2884%29+-+F%2852%29%5D%5E%7B8%7D&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='L(&#92;mu, &#92;sigma) &#92;propto f(52) f(84) [F(84) - F(52)]^{8}' title='L(&#92;mu, &#92;sigma) &#92;propto f(52) f(84) [F(84) - F(52)]^{8}' class='latex' /></p>
<p>In the next blog posting, I&#8217;ll describe how to summarize this posterior by a normal approximation in LearnBayes.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learnbayes.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learnbayes.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learnbayes.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learnbayes.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learnbayes.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learnbayes.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learnbayes.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learnbayes.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learnbayes.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learnbayes.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learnbayes.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learnbayes.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learnbayes.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learnbayes.wordpress.com/410/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=410&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learnbayes.wordpress.com/2011/09/22/learning-from-the-extremes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e40b14d1e48f8189f4d7d012481145b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bayesball</media:title>
		</media:content>
	</item>
		<item>
		<title>Normal approximation to posterior</title>
		<link>http://learnbayes.wordpress.com/2011/09/22/normal-approximation-to-posterior/</link>
		<comments>http://learnbayes.wordpress.com/2011/09/22/normal-approximation-to-posterior/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 01:20:22 +0000</pubDate>
		<dc:creator>bayesball</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://learnbayes.wordpress.com/?p=406</guid>
		<description><![CDATA[To illustrate a normal approximation to a posterior, let&#8217;s return to the fire call example described in the September 6 post.  Here we had Poisson sampling with mean and a normal prior on . 1.  First we write a short function lpost that computes the logarithm of the posterior.  I show the expressions for the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=406&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To illustrate a normal approximation to a posterior, let&#8217;s return to the fire call example described in <a href="http://learnbayes.wordpress.com/2011/09/06/brute-force-bayes-for-one-parameter/">the September 6 post</a>.  Here we had Poisson sampling with mean <img src='http://s0.wp.com/latex.php?latex=%5Clambda&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;lambda' title='&#92;lambda' class='latex' /> and a normal prior on <img src='http://s0.wp.com/latex.php?latex=%5Clambda&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;lambda' title='&#92;lambda' class='latex' />.</p>
<p>1.  First we write a short function lpost that computes the logarithm of the posterior.  I show the expressions for the log likelihood and the log prior.  On the log scale, the log posterior is the log likelihood PLUS the log prior.</p>
<pre>lpost = function(lambda){
  loglike = -6*lambda + 8*log(lambda)
  logprior = dnorm(lambda, 3, 1, log=TRUE)
  loglike + logprior
}</pre>
<p>2.  I plot the normalized version of the posterior below.  I first write a short function post that computes the posterior, use the integrate function to numerically integrate the density from 0 to 10, and then use the curve function to display the normalized posterior.</p>
<pre>post = function(lambda) exp(lpost(lambda))
C = integrate(post, 0, 10)
curve(exp(lpost(x))/C$value, 0, 5)
<a href="http://learnbayes.files.wordpress.com/2011/09/rplot01.png"><img class="alignleft size-full wp-image-407" title="Rplot01" src="http://learnbayes.files.wordpress.com/2011/09/rplot01.png?w=535&#038;h=437" alt="" width="535" height="437" /></a></pre>
<p>3.  There is a useful function laplace in the LearnBayes package that conveniently finds the matching normal approximation to the posterior.  The function inputs are (1) the function defining the log posterior, and (2) a guess at the posterior mode.  Typically the log posterior might depend on data and prior parameters and that would be the last input to laplace (here we are not using that extra input).</p>
<pre>library(LearnBayes)
fit=laplace(lpost, 1)
fit
$mode
[1] 1.7
$var
          [,1]
[1,] 0.2653809</pre>
<p>The important output here is (1) the mode of the posterior and (2) the corresponding approximation to the posterior variance.  By looking at the output, we see that the posterior of <img src='http://s0.wp.com/latex.php?latex=%5Clambda&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;lambda' title='&#92;lambda' class='latex' /> is approximately N(1.7, <img src='http://s0.wp.com/latex.php?latex=%5Csqrt%7B0.265%7D&amp;bg=f4d0a8&amp;fg=453320&amp;s=0' alt='&#92;sqrt{0.265}' title='&#92;sqrt{0.265}' class='latex' />).</p>
<p>4.  To check the accuracy of this approximation, we use the curve function to add a matching normal density.  (I have also added a legend by use of the legend function.)  Note that the normal approximation is pretty accurate in this particular case.</p>
<pre>curve(dnorm(x, fit$mode, sqrt(fit$var)), add=TRUE, col="red")
legend("topright", legend=c("Exact", "Normal Approximation"),
       lty = 1, col=c("black", "red"))</pre>
<p><a href="http://learnbayes.files.wordpress.com/2011/09/rplot21.png"><img class="alignleft size-full wp-image-408" title="Rplot2" src="http://learnbayes.files.wordpress.com/2011/09/rplot21.png?w=535&#038;h=437" alt="" width="535" height="437" /></a></p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learnbayes.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learnbayes.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learnbayes.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learnbayes.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learnbayes.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learnbayes.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learnbayes.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learnbayes.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learnbayes.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learnbayes.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learnbayes.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learnbayes.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learnbayes.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learnbayes.wordpress.com/406/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learnbayes.wordpress.com&amp;blog=9058777&amp;post=406&amp;subd=learnbayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learnbayes.wordpress.com/2011/09/22/normal-approximation-to-posterior/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e40b14d1e48f8189f4d7d012481145b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bayesball</media:title>
		</media:content>

		<media:content url="http://learnbayes.files.wordpress.com/2011/09/rplot01.png" medium="image">
			<media:title type="html">Rplot01</media:title>
		</media:content>

		<media:content url="http://learnbayes.files.wordpress.com/2011/09/rplot21.png" medium="image">
			<media:title type="html">Rplot2</media:title>
		</media:content>
	</item>
	</channel>
</rss>
