<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>PUBH 7440 - Intro to Bayesian Analysis</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/quic0038/pubh7440/" />
    <link rel="self" type="application/atom+xml" href="http://blog.lib.umn.edu/quic0038/pubh7440/atom.xml" />
    <id>tag:blog.lib.umn.edu,2011-01-12:/quic0038/pubh7440//13219</id>
    <updated>2012-04-26T16:48:09Z</updated>
    
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Enterprise 4.31-en</generator>

<entry>
    <title>My Spatial Lecture!</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/quic0038/pubh7440/2012/04/my-spatial-lecture.html" />
    <id>tag:blog.lib.umn.edu,2012:/quic0038/pubh7440//13219.353415</id>

    <published>2012-04-26T16:42:40Z</published>
    <updated>2012-04-26T16:48:09Z</updated>

    <summary>The first part! The second part!...</summary>
    <author>
        <name>quic0038</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-us" xml:base="http://blog.lib.umn.edu/quic0038/pubh7440/">
        <![CDATA[<p><a href="http://blog.lib.umn.edu/quic0038/pubh7440/Impact%20of%20Alcohol%20Outlet%20Density%20on%20Crime%20in%20MPLS.pdf">The first part!</a></p>

<p><a href="http://blog.lib.umn.edu/quic0038/pubh7440/Temporal%20Gradients%20in%20Areal%20Data.pdf">The second part!</a></p>]]>
        
    </content>
</entry>

<entry>
    <title>Example of Metropolis Algorithm</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/quic0038/pubh7440/2012/03/example-of-metropolis-algorithm.html" />
    <id>tag:blog.lib.umn.edu,2012:/quic0038/pubh7440//13219.346628</id>

    <published>2012-03-20T05:08:09Z</published>
    <updated>2012-03-20T05:08:32Z</updated>

    <summary>Below is an example for coding up the Metropolis algorithm in R. Here, 1) the parameter of interest is &quot;b&quot;, 2) &quot;rq()&quot; is generating a random value from q, my candidate density, which I&apos;m saying is just a N(b,1), and...</summary>
    <author>
        <name>quic0038</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-us" xml:base="http://blog.lib.umn.edu/quic0038/pubh7440/">
        <![CDATA[<p>Below is an example for coding up the Metropolis algorithm in R.  Here, <br />
1) the parameter of interest is "b", <br />
2) "rq()" is generating a random value from q, my candidate density, which I'm saying is just a N(b,1), and<br />
3) "h()" is the unnormalized posterior, which for me is just N(0,4)<br />
Also, you don't have to make a function like my "met_b", but it cleans things up a bit.</p>

<p>Obviously, when you're doing the homework, h() may depend on other parameters and will certainly depend on the data, y.</p>

<p>#################functions...##########################<br />
met_b=function(b){<br />
  #given the current position of the chain, b, this will generate the next</p>

<p>  bs = rq(1, b) #sample 1 value from q( |b)<br />
  r = h(bs)/h(b) #you may need to use some algebra to simplify this expression,<br />
  #especially in multivariate settings where h(x) can be super small<br />
  if(r >= 1){<br />
    return(bs)<br />
  }else if(r >= runif(1)){<br />
    return(bs)<br />
  }else{<br />
    return(b)<br />
  }<br />
}</p>

<p>rq=function(num,x){<br />
  return(rnorm(num,mean=x,sd=1))<br />
}</p>

<p>h=function(x){<br />
  return(dnorm(x,sd=2))<br />
}<br />
###################main part...########################</p>

<p>T=1000  #the number of iterations you want... start small, and go from there<br />
b=array(dim=c(T))  #makes b a vector of length T.  <br />
# If b is a k-vector, you can replace "c(T)" with "c(T,k)"<br />
b[1]=0 #initialize b<br />
for(it in 2:T){<br />
  b[it] = met_b(b[it-1])<br />
}<br />
par(mfrow=c(1,2))<br />
plot(y=b,x=1:T,type='l',main='History')<br />
hist(b,main='Density',freq=FALSE)</p>]]>
        
    </content>
</entry>

<entry>
    <title>Code for Thursday&apos;s Lecture</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/quic0038/pubh7440/2012/02/code-for-thursdays-lecture.html" />
    <id>tag:blog.lib.umn.edu,2012:/quic0038/pubh7440//13219.337777</id>

    <published>2012-02-09T20:17:47Z</published>
    <updated>2012-02-09T20:20:35Z</updated>

    <summary>(in reverse alphabetical order...) stacks_BUGS.txt MACfrailty_BUGS.txt MAC.txt dugongsNL_BUGS.txt dugongsBin_BUGS.txt dugongs_BUGS.txt crprot_BUGS.txt...</summary>
    <author>
        <name>quic0038</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-us" xml:base="http://blog.lib.umn.edu/quic0038/pubh7440/">
        <![CDATA[<p>(in reverse alphabetical order...)<br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/stacks_BUGS.txt">stacks_BUGS.txt</a><br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/MACfrailty_BUGS.txt">MACfrailty_BUGS.txt</a><br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/MAC.txt">MAC.txt</a><br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/dugongsNL_BUGS.txt">dugongsNL_BUGS.txt</a><br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/dugongsBin_BUGS.txt">dugongsBin_BUGS.txt</a><br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/dugongs_BUGS.txt">dugongs_BUGS.txt</a><br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/crprot_BUGS.txt">crprot_BUGS.txt</a></p>]]>
        
    </content>
</entry>

<entry>
    <title>Code used in Tuesday&apos;s R/WinBUGS lecture</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/quic0038/pubh7440/2012/02/code-used-in-tuesdays-rwinbugs-lecture.html" />
    <id>tag:blog.lib.umn.edu,2012:/quic0038/pubh7440//13219.337327</id>

    <published>2012-02-07T06:07:13Z</published>
    <updated>2012-02-07T06:19:25Z</updated>

    <summary>Ex 1 - hv.r Ex 2 - Pumps!.txt Ex 3 - InterStim.txt oh, and: HW 2 is due Thursday and HW 3 is &quot;officially&quot; assigned (due 2/21)...</summary>
    <author>
        <name>quic0038</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-us" xml:base="http://blog.lib.umn.edu/quic0038/pubh7440/">
        <![CDATA[<p><a href="http://blog.lib.umn.edu/quic0038/pubh7440/Ex%201%20-%20hv.r">Ex 1 - hv.r</a><br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/Ex%202%20-%20Pumps%21.txt">Ex 2 - Pumps!.txt</a><br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/Ex%203%20-%20InterStim.txt">Ex 3 - InterStim.txt</a></p>

<p>oh, and:<br />
HW 2 is due Thursday and<br />
HW 3 is "officially" assigned (due 2/21)</p>]]>
        
    </content>
</entry>

<entry>
    <title>R Programming: Files from Prof. Koopmeiners&apos; Lecture</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/quic0038/pubh7440/2012/01/r-programming-files-from-prof-koopmeiners-lecture.html" />
    <id>tag:blog.lib.umn.edu,2012:/quic0038/pubh7440//13219.335040</id>

    <published>2012-01-26T02:53:59Z</published>
    <updated>2012-01-26T03:07:43Z</updated>

    <summary>In case you&apos;re interested, here are all of the necessary files from Prof. Koopmeiners&apos; lecture on R from Jan. 24th R Slides grades_example.R grades_example.txt grades_example.csv If you have any questions with this program, or R programming in general, don&apos;t hesitate...</summary>
    <author>
        <name>quic0038</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-us" xml:base="http://blog.lib.umn.edu/quic0038/pubh7440/">
        <![CDATA[<p>In case you're interested, here are all of the necessary files from Prof. Koopmeiners' lecture on R from Jan. 24th</p>

<p><a href="http://blog.lib.umn.edu/quic0038/pubh7440/PubH_7440_20110126.pdf">R Slides</a><br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/grades_example.R">grades_example.R</a><br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/grades_example.txt">grades_example.txt</a><br />
<a href="http://blog.lib.umn.edu/quic0038/pubh7440/grades_example.csv">grades_example.csv</a></p>

<p>If you have any questions with this program, or R programming in general, don't hesitate to <a href="mailto:quic0038@umn.edu">email</a> me</p>]]>
        
    </content>
</entry>

<entry>
    <title>First Blog Entry for 2012!</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/quic0038/pubh7440/2012/01/first-blog-entry-for-2012.html" />
    <id>tag:blog.lib.umn.edu,2012:/quic0038/pubh7440//13219.328359</id>

    <published>2012-01-01T06:00:01Z</published>
    <updated>2012-01-12T09:01:52Z</updated>

    <summary>I&apos;ll occasionally write things on here like course reminders (like midterm deadlines), updates (regarding changes in office hours), and some homework help. I&apos;m tentatively planning on having the following office hours: Tuesday 11-1 Thursday 12-2. I also check my email...</summary>
    <author>
        <name>quic0038</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-us" xml:base="http://blog.lib.umn.edu/quic0038/pubh7440/">
        <![CDATA[<p>I'll occasionally write things on here like course reminders (like midterm deadlines), updates (regarding changes in office hours), and some homework help.</p>

<p>I'm tentatively planning on having the following office hours:<br />
Tuesday 11-1<br />
Thursday 12-2.</p>

<p>I also check my <a href="mailto:quic0038@umn.edu">email</a> pretty frequently, so feel free to ask me any questions you may have.</p>

<p>Harrison</p>]]>
        
    </content>
</entry>

</feed>
