<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Omne trium perfectum: JMP add-in for WinBUGS in JMP Blog</title>
    <link>https://community.jmp.com/t5/JMP-Blog/Omne-trium-perfectum-JMP-add-in-for-WinBUGS/ba-p/30298</link>
    <description>&lt;P&gt;There's a bit of Latin that states "omne trium perfectum" or "everything that comes in threes is perfect." I had not set out to write three posts in a row on &lt;A href="http://blogs.sas.com/content/jmp/tag/mcmc/"&gt;Markov Chain Monte Carlo&lt;/A&gt; (MCMC), but sometimes the stars align in such a way that the story continues to write itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But first, a joke:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;A Bayesian and Frequentist apply for the same job. The interviewer tells the Frequentist, "Sorry to tell you this. You're a great candidate, but we decided to go with the Bayesian." The Frequentist is disappointed but says, "I understand, but can you tell me what tipped the balance in her favor?" The interviewer says, " On paper, you both have the same qualifications. However, the Bayesian has prior experience."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This post is actually the result of some feedback we received from one of our &lt;A href="http://jmp.com/software"&gt;JMP&lt;/A&gt; users who frequently fits models&amp;nbsp;using WinBUGS. While&amp;nbsp;he found the &lt;A href="https://community.jmp.com/docs/DOC-6103"&gt;MCMC Diagnostics&lt;/A&gt; add-in useful to explore posterior samples,&amp;nbsp;he found it difficult to get WinBUGS output into the appropriate form. He sent me the following example to work with:&amp;nbsp; Wolfinger&amp;nbsp;(1998)&amp;nbsp;&amp;nbsp;analyzes tensile strength measurements for a composite material used in aircraft components (data in Table 4 in &lt;A href="http://www.jstor.org/stable/1269233" target="_blank"&gt;Vangel (1992)&lt;/A&gt;) using a model with 8 parameters. Requesting 11,000 posterior samples (assuming the first 1,000&amp;nbsp;are burn-in samples that will be tossed) for a single chain generates two output files in WinBUGS. The first, index.txt, is a list of parameters with the starting and stopping&amp;nbsp;observation numbers. For this example, the contents of index.txt look like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[1]&amp;nbsp;1&amp;nbsp;11000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[2]&amp;nbsp;11001&amp;nbsp;22000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[3]&amp;nbsp;22001&amp;nbsp;33000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[4]&amp;nbsp;33001&amp;nbsp;44000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[5]&amp;nbsp;44001&amp;nbsp;55000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mu&amp;nbsp;55001&amp;nbsp;66000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sigma2.a&amp;nbsp;66001&amp;nbsp;77000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sigma2.e&amp;nbsp;77001&amp;nbsp;88000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second file called chain 1.txt contains 2 columns. The first column is the iteration number 1 to 11,000 repeated 8 times,&amp;nbsp;while the second column contains the sampled values for the 8 parameters; essentially an 88,000&amp;nbsp;x 2 matrix. How can these output files be used by the JMP MCMC Diagnostic add-in (which assumes rows are samples within chains and columns are parameters)? Just apply the freely available &lt;A href="https://community.jmp.com/docs/DOC-6104"&gt;WinBUGS to JMP Conversion add-in&lt;/A&gt;! (Download requires free SAS profile.) The add-in asks for the directory location of&amp;nbsp;WinBUGS output files (index.txt and chain 1.txt, chain 2.txt etc) and creates a JMP table called MCMC Samples (which can be saved with a new name). See Figure 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/legacyfs/online/wp_images/2013/05/WinBUGS.jpg"&gt;&lt;IMG class="size-medium wp-image-8955" src="https://community.jmp.com/legacyfs/online/wp_images/2013/05/WinBUGS-264x300.jpg" alt="" width="264" height="300" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P class="wp-caption-text"&gt;&lt;STRONG&gt; Figure 1. JMP Table of MCMC Samples Converted from WinBUGS Output Files&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A few points to consider. First, the data table in Figure 1 includes the first 1,000 samples that were intended as burn-in. I can either delete the rows from the table, or exclude the rows from analysis by selecting the first 1000 rows, right-clicking and choosing "Exclude/Unexclude." This causes the MCMC Diagnostics add-in to ignore these rows as if they were not present. I can always Unexclude later if I would like to examine the burn-in samples in further detail, say,&amp;nbsp;to assess the speed of convergence in trace plots. Second, notice how the parameters a&lt;I&gt; were renamed as a_i.&amp;nbsp; This was intentional so that variable names&amp;nbsp;were not interpreted as an array by the conversion process. Make note of this as you name your parameters within WinBugs,&amp;nbsp; since the conversion may result in columns with duplicated names.&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reference&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Wolfinger RD. (1998). Tolerance intervals for variance component models using Bayesian simulation. &lt;EM&gt;Journal of Quality Technology&lt;/EM&gt; 30: 18-32.&lt;/P&gt;</description>
    <pubDate>Tue, 28 May 2013 20:37:51 GMT</pubDate>
    <dc:creator>Richard_Zink</dc:creator>
    <dc:date>2013-05-28T20:37:51Z</dc:date>
    <item>
      <title>Omne trium perfectum: JMP add-in for WinBUGS</title>
      <link>https://community.jmp.com/t5/JMP-Blog/Omne-trium-perfectum-JMP-add-in-for-WinBUGS/ba-p/30298</link>
      <description>&lt;P&gt;There's a bit of Latin that states "omne trium perfectum" or "everything that comes in threes is perfect." I had not set out to write three posts in a row on &lt;A href="http://blogs.sas.com/content/jmp/tag/mcmc/"&gt;Markov Chain Monte Carlo&lt;/A&gt; (MCMC), but sometimes the stars align in such a way that the story continues to write itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But first, a joke:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;A Bayesian and Frequentist apply for the same job. The interviewer tells the Frequentist, "Sorry to tell you this. You're a great candidate, but we decided to go with the Bayesian." The Frequentist is disappointed but says, "I understand, but can you tell me what tipped the balance in her favor?" The interviewer says, " On paper, you both have the same qualifications. However, the Bayesian has prior experience."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This post is actually the result of some feedback we received from one of our &lt;A href="http://jmp.com/software"&gt;JMP&lt;/A&gt; users who frequently fits models&amp;nbsp;using WinBUGS. While&amp;nbsp;he found the &lt;A href="https://community.jmp.com/docs/DOC-6103"&gt;MCMC Diagnostics&lt;/A&gt; add-in useful to explore posterior samples,&amp;nbsp;he found it difficult to get WinBUGS output into the appropriate form. He sent me the following example to work with:&amp;nbsp; Wolfinger&amp;nbsp;(1998)&amp;nbsp;&amp;nbsp;analyzes tensile strength measurements for a composite material used in aircraft components (data in Table 4 in &lt;A href="http://www.jstor.org/stable/1269233" target="_blank"&gt;Vangel (1992)&lt;/A&gt;) using a model with 8 parameters. Requesting 11,000 posterior samples (assuming the first 1,000&amp;nbsp;are burn-in samples that will be tossed) for a single chain generates two output files in WinBUGS. The first, index.txt, is a list of parameters with the starting and stopping&amp;nbsp;observation numbers. For this example, the contents of index.txt look like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[1]&amp;nbsp;1&amp;nbsp;11000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[2]&amp;nbsp;11001&amp;nbsp;22000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[3]&amp;nbsp;22001&amp;nbsp;33000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[4]&amp;nbsp;33001&amp;nbsp;44000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[5]&amp;nbsp;44001&amp;nbsp;55000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mu&amp;nbsp;55001&amp;nbsp;66000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sigma2.a&amp;nbsp;66001&amp;nbsp;77000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sigma2.e&amp;nbsp;77001&amp;nbsp;88000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second file called chain 1.txt contains 2 columns. The first column is the iteration number 1 to 11,000 repeated 8 times,&amp;nbsp;while the second column contains the sampled values for the 8 parameters; essentially an 88,000&amp;nbsp;x 2 matrix. How can these output files be used by the JMP MCMC Diagnostic add-in (which assumes rows are samples within chains and columns are parameters)? Just apply the freely available &lt;A href="https://community.jmp.com/docs/DOC-6104"&gt;WinBUGS to JMP Conversion add-in&lt;/A&gt;! (Download requires free SAS profile.) The add-in asks for the directory location of&amp;nbsp;WinBUGS output files (index.txt and chain 1.txt, chain 2.txt etc) and creates a JMP table called MCMC Samples (which can be saved with a new name). See Figure 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/legacyfs/online/wp_images/2013/05/WinBUGS.jpg"&gt;&lt;IMG class="size-medium wp-image-8955" src="https://community.jmp.com/legacyfs/online/wp_images/2013/05/WinBUGS-264x300.jpg" alt="" width="264" height="300" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P class="wp-caption-text"&gt;&lt;STRONG&gt; Figure 1. JMP Table of MCMC Samples Converted from WinBUGS Output Files&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A few points to consider. First, the data table in Figure 1 includes the first 1,000 samples that were intended as burn-in. I can either delete the rows from the table, or exclude the rows from analysis by selecting the first 1000 rows, right-clicking and choosing "Exclude/Unexclude." This causes the MCMC Diagnostics add-in to ignore these rows as if they were not present. I can always Unexclude later if I would like to examine the burn-in samples in further detail, say,&amp;nbsp;to assess the speed of convergence in trace plots. Second, notice how the parameters a&lt;I&gt; were renamed as a_i.&amp;nbsp; This was intentional so that variable names&amp;nbsp;were not interpreted as an array by the conversion process. Make note of this as you name your parameters within WinBugs,&amp;nbsp; since the conversion may result in columns with duplicated names.&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reference&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Wolfinger RD. (1998). Tolerance intervals for variance component models using Bayesian simulation. &lt;EM&gt;Journal of Quality Technology&lt;/EM&gt; 30: 18-32.&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2013 20:37:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/JMP-Blog/Omne-trium-perfectum-JMP-add-in-for-WinBUGS/ba-p/30298</guid>
      <dc:creator>Richard_Zink</dc:creator>
      <dc:date>2013-05-28T20:37:51Z</dc:date>
    </item>
  </channel>
</rss>

