<?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>topic Why does Proc MCMC taking too long to finish? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Why-does-Proc-MCMC-taking-too-long-to-finish/m-p/529927#M26806</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am doing a Hierarchical Bayesian Analysis using the Proc MCMC procedure. I have got three level model; however, the Proc MCMC is not working for me. It is taking too long to finish even for the empty model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I started doing the analysis from the empty model and it takes more than 10 minutes to finish off. Here is a sample code I used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc mcmc data = care seed = 10 nmc = 200000 nbi = 10000 thin = 2 outpost = xcare DIC;&lt;/P&gt;&lt;P&gt;Prams beta0 sig2 delta2;&lt;/P&gt;&lt;P&gt;Prior beta0 ~ normal (0, var = 1000);&lt;/P&gt;&lt;P&gt;prior sig2 ~ igamma (shape = 0.1, scale = 0.01);&lt;/P&gt;&lt;P&gt;prior delta2 ~ igamma (shape = 0.1, scale = 0.01);&lt;/P&gt;&lt;P&gt;mu = beta0;&lt;/P&gt;&lt;P&gt;random gamma ~ normal (0, var = sig2) subject = region;&lt;/P&gt;&lt;P&gt;random delta ~ normal (0, var = delta2) subject = clusterXregion; (clusters are nested within region)&lt;/P&gt;&lt;P&gt;p = logistic(mu + gamma + delta);&lt;/P&gt;&lt;P&gt;model use ~ binary(p);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moreover, when I include fixed effects and random slopes, the program stops.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate your support in this regard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With kind regards&lt;/P&gt;&lt;P&gt;Teketo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Jan 2019 23:55:59 GMT</pubDate>
    <dc:creator>Teketo</dc:creator>
    <dc:date>2019-01-24T23:55:59Z</dc:date>
    <item>
      <title>Why does Proc MCMC taking too long to finish?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Why-does-Proc-MCMC-taking-too-long-to-finish/m-p/529928#M26804</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am doing a Hierarchical Bayesian Analysis using the Proc MCMC procedure. I have got three level model; however, the Proc MCMC is not working for me. It is taking too long to finish even for the empty model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I started doing the analysis from the empty model and it takes more than 10 minutes to finish off. Here is a sample code I used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc mcmc data = care seed = 10 nmc = 200000 nbi = 10000 thin = 2 outpost = xcare DIC;&lt;/P&gt;&lt;P&gt;Prams beta0 sig2 delta2;&lt;/P&gt;&lt;P&gt;Prior beta0 ~ normal (0, var = 1000);&lt;/P&gt;&lt;P&gt;prior sig2 ~ igamma (shape = 0.1, scale = 0.01);&lt;/P&gt;&lt;P&gt;prior delta2 ~ igamma (shape = 0.1, scale = 0.01);&lt;/P&gt;&lt;P&gt;mu = beta0;&lt;/P&gt;&lt;P&gt;random gamma ~ normal (0, var = sig2) subject = region;&lt;/P&gt;&lt;P&gt;random delta ~ normal (0, var = delta2) subject = clusterXregion; (clusters are nested within region)&lt;/P&gt;&lt;P&gt;p = logistic(mu + gamma + delta);&lt;/P&gt;&lt;P&gt;model use ~ binary(p);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moreover, when I include fixed effects and random slopes, the program stops.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate your support in this regard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With kind regards&lt;/P&gt;&lt;P&gt;Teketo&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 00:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Why-does-Proc-MCMC-taking-too-long-to-finish/m-p/529928#M26804</guid>
      <dc:creator>Teketo</dc:creator>
      <dc:date>2019-01-25T00:00:22Z</dc:date>
    </item>
    <item>
      <title>Why does Proc MCMC taking too long to finish?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Why-does-Proc-MCMC-taking-too-long-to-finish/m-p/529927#M26806</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am doing a Hierarchical Bayesian Analysis using the Proc MCMC procedure. I have got three level model; however, the Proc MCMC is not working for me. It is taking too long to finish even for the empty model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I started doing the analysis from the empty model and it takes more than 10 minutes to finish off. Here is a sample code I used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc mcmc data = care seed = 10 nmc = 200000 nbi = 10000 thin = 2 outpost = xcare DIC;&lt;/P&gt;&lt;P&gt;Prams beta0 sig2 delta2;&lt;/P&gt;&lt;P&gt;Prior beta0 ~ normal (0, var = 1000);&lt;/P&gt;&lt;P&gt;prior sig2 ~ igamma (shape = 0.1, scale = 0.01);&lt;/P&gt;&lt;P&gt;prior delta2 ~ igamma (shape = 0.1, scale = 0.01);&lt;/P&gt;&lt;P&gt;mu = beta0;&lt;/P&gt;&lt;P&gt;random gamma ~ normal (0, var = sig2) subject = region;&lt;/P&gt;&lt;P&gt;random delta ~ normal (0, var = delta2) subject = clusterXregion; (clusters are nested within region)&lt;/P&gt;&lt;P&gt;p = logistic(mu + gamma + delta);&lt;/P&gt;&lt;P&gt;model use ~ binary(p);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moreover, when I include fixed effects and random slopes, the program stops.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate your support in this regard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With kind regards&lt;/P&gt;&lt;P&gt;Teketo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 23:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Why-does-Proc-MCMC-taking-too-long-to-finish/m-p/529927#M26806</guid>
      <dc:creator>Teketo</dc:creator>
      <dc:date>2019-01-24T23:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why does Proc MCMC taking too long to finish?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Why-does-Proc-MCMC-taking-too-long-to-finish/m-p/529931#M26805</link>
      <description>&lt;P&gt;First thing I see is that your NMC and NBI options are orders of magnitude greater than the default 1000. Did you try with the defaults? How long did that take.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also from the documentation details on computational resources:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#ff0000" face="SAS Monospace" size="2"&gt;Computational&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; Resources&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;It is impossible to estimate how long it will take for a general Markov chain to converge to its stationary distribution.It takes a skilled and thoughtful analysis of the chain to decide whether it has converged to the target distribution andwhether the chain is mixing rapidly &lt;/FONT&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;enough.&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; In some cases, you might be able to estimate how long a particular simulationmight &lt;/FONT&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;take.&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; The running time of a program that does not have RANDOMstatements is approximately linear to the following factors: the number of samples in the input data set, the number of simulations,the number of blocks in the program, and the speed of your &lt;/FONT&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;computer.&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; For an analysis that uses a data set of size nsamples, a simulation length of nsim, and a block design of nblocks, PROC MCMC evaluates the log-likelihood function the following number of times, excluding the tuning phase: &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;\[ {\mi{nsamples}} \times {\mi{nsim}} \times {\mi{nblocks}} \]&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;The faster your computer evaluates a single log-likelihood function, the faster this program &lt;/FONT&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;runs.&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; Suppose you have nsamples equal to &lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;200&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;, nsim equal to &lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;55&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;000&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;, and nblocks equal to &lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;3.&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; PROC MCMC evaluates the log-likelihood function approximately &lt;/FONT&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;$3.3&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;\times &lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;10&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;^&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;7&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;$ &lt;/FONT&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;times.&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; If your computer can evaluate the log likelihood for one observation $&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;10&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;^&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;6&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;$ times per second, this program takes approximately a half a minute to &lt;/FONT&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;run.&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; If you want to increase the number of simulationsfive-fold, the run time increases approximately five-&lt;/FONT&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;fold.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the above is &lt;STRONG&gt;without&lt;/STRONG&gt; RANDOM statements. Each &lt;A href="http://127.0.0.1:50932/help/statug.hlp/statug_mcmc_syntax15.htm" target="_blank"&gt;RANDOM&lt;/A&gt; statement adds one pass through the input data at each iteration. So how big is your data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 00:26:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Why-does-Proc-MCMC-taking-too-long-to-finish/m-p/529931#M26805</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-25T00:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Why does Proc MCMC taking too long to finish?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Why-does-Proc-MCMC-taking-too-long-to-finish/m-p/532032#M26822</link>
      <description>It is hard to say for sure without knowing more about the data and the levels of cluster and regions, but initially I would say that NMC=200000 is the likely culprit.  Why have you set it so large?&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Feb 2019 15:14:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Why-does-Proc-MCMC-taking-too-long-to-finish/m-p/532032#M26822</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2019-02-01T15:14:20Z</dc:date>
    </item>
  </channel>
</rss>

