<?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 Re: Beta - Binomial Bayesian Model in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846666#M41923</link>
    <description>&lt;P&gt;The documentation for PROC FMM and HPFMM have the equations for the likelihood for a beta-binomial. Those could be incorporated into MCMC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
    <pubDate>Mon, 28 Nov 2022 18:35:58 GMT</pubDate>
    <dc:creator>SteveDenham</dc:creator>
    <dc:date>2022-11-28T18:35:58Z</dc:date>
    <item>
      <title>Beta - Binomial Bayesian Model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/845834#M41882</link>
      <description>&lt;P&gt;I am trying to fit a logistic regression model to a dataset that where the outcome is binary (0, 1), and the independent variable is treatment group (2 values, 0 and 1). I would like a beta (1,1) / Uniform(0, 1) prior on the probability of success, p.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the following code to model the outcome. There are missing values in the outcome variable which are excluded from the analysis using proc genmod.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Question: Is it possible to impute missing values in proc genmod, so all of the data can be used in the analysis?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;/***************************************************************************************/&lt;/P&gt;
&lt;P&gt;proc genmod data=ds;&lt;BR /&gt;model s = trt /d=bin link=logit;&lt;BR /&gt;bayes seed=17 coeffprior=uniform nmc=20000 thin=2 outpost=outgen;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;/***************************************************************************************/&lt;/P&gt;
&lt;P&gt;As an alternative, I am using proc mcmc which imputes the missing outcome values. But, I am a bit confused on how to assign a beta prior to the parameter p in the binomial distribution.&lt;/P&gt;
&lt;P&gt;/***************************************************************************************/&lt;/P&gt;
&lt;P&gt;proc mcmc data=ds seed=123 outpost=logit_bayes nbi=1000 nmc=10000 nthin=1 DIC statistics=all diagnostics=all; &lt;BR /&gt;parms (beta0 beta1 /*p*/);&lt;BR /&gt;prior beta0 ~ normal(0, var=10000);&lt;BR /&gt;prior beta1 ~ normal(0, var=10000);&lt;BR /&gt;/*prior p ~ beta(1,1);*/&lt;BR /&gt;p=logistic(beta0 + beta1*trt);&lt;BR /&gt;model s ~ binomial(1,p); &lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;/***************************************************************************************/&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Question: Is there a way to modify/change the mcmc code above to specify a beta prior so inferences about the parameter p can be made?&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 03:49:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/845834#M41882</guid>
      <dc:creator>kc</dc:creator>
      <dc:date>2022-11-23T03:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Beta - Binomial Bayesian Model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/845965#M41886</link>
      <description>&lt;P&gt;That all seems like overkill for what is really just a 2x2 table. If your goal is to estimate the probability of the event in each treatment and to compare them, then a model-based approach is not needed - you can do that in PROC FREQ using the RISKDIFF option. There are even options to do an exact analysis if desired. Imputation can be done using PROC MI, but with no other variables available, I can't see how any meaningful imputation can be done.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 16:05:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/845965#M41886</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2022-11-23T16:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Beta - Binomial Bayesian Model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846001#M41888</link>
      <description>&lt;P&gt;Agreed. But, the exercise is to run a bayesian analysis. If you were to still use proc mcmc, how do you specify a beta prior on the binomial parameter p, instead of specifying priors on the regression parameters beta0 and beta1. Apologies if the question itself isn't clear or doesn't make sense.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 19:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846001#M41888</guid>
      <dc:creator>kc</dc:creator>
      <dc:date>2022-11-23T19:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Beta - Binomial Bayesian Model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846666#M41923</link>
      <description>&lt;P&gt;The documentation for PROC FMM and HPFMM have the equations for the likelihood for a beta-binomial. Those could be incorporated into MCMC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 18:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846666#M41923</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2022-11-28T18:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Beta - Binomial Bayesian Model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846895#M41937</link>
      <description>&lt;P&gt;When using the proc mcmc code below , I get the following error:&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;ERROR: Parameters cannot have values assigned to them in the program. Change the assignment statement for the parameter prob.&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;mcmc&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;data=ds&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;outpost=PosteriorSample&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;nmc=&lt;STRONG&gt;20000&lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;propcov=quanew&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ntu=&lt;STRONG&gt;1000&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;nthin=&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;seed=&lt;STRONG&gt;7&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;diag=all&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;stats=all&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;dic;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;parms&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;b0 b1 prob;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;prior&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;b0 ~&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;normal(&lt;STRONG&gt;0.01&lt;/STRONG&gt;, var=&lt;STRONG&gt;10000&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;prior&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;b1 ~&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;normal(&lt;STRONG&gt;0.01&lt;/STRONG&gt;, var=&lt;STRONG&gt;10000&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;prior&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;prob ~&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;beta(&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;1&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp; xb = b0 + b1*rand_arm;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp; prob = exp(xb)/(&lt;STRONG&gt;1&lt;/STRONG&gt;+exp(xb));&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp; ll = log((prob**m6)*((&lt;STRONG&gt;1&lt;/STRONG&gt;-prob)**(&lt;STRONG&gt;1&lt;/STRONG&gt;-m6)));&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;model&lt;SPAN&gt;&amp;nbsp;m&lt;/SPAN&gt;6 ~&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;general(ll);&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ods&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;select&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;PostSummaries PostIntervals TADPanel;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 19:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846895#M41937</guid>
      <dc:creator>kc</dc:creator>
      <dc:date>2022-11-29T19:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Beta - Binomial Bayesian Model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846896#M41938</link>
      <description>&lt;P&gt;Since Prob is just the predicted value after applying a link function to the linear predictor, it should not be listed as a parameter in the model.&amp;nbsp; In other words, you should remove it from the PARMS and PRIOR statements.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 19:12:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846896#M41938</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2022-11-29T19:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Beta - Binomial Bayesian Model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846898#M41939</link>
      <description>But, the purpose is to make inferences about the binomial probability 'prob' as mentioned in the original post. This code was just to show that I tried writing out the likelihood function for the model.</description>
      <pubDate>Tue, 29 Nov 2022 19:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846898#M41939</guid>
      <dc:creator>kc</dc:creator>
      <dc:date>2022-11-29T19:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Beta - Binomial Bayesian Model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846901#M41940</link>
      <description>&lt;P&gt;You can still get posterior intervals, plots, summaries etc. for Prob.&amp;nbsp; But it is just a function of the other parameters and thus is not truly a parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc mcmc data=mylib.ds outpost=PosteriorSample nmc=20000&lt;/P&gt;
&lt;P&gt;propcov=quanew ntu=1000 nthin=2 seed=7 diag=all stats=all dic monitor=(prob);&lt;/P&gt;
&lt;P&gt;parms b0 b1;&lt;/P&gt;
&lt;P&gt;prior b0 ~ normal(0.01, var=10000);&lt;/P&gt;
&lt;P&gt;prior b1 ~ normal(0.01, var=10000);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;xb = b0 + b1*rand_arm;&lt;/P&gt;
&lt;P&gt;prob = exp(xb)/(1+exp(xb));&lt;/P&gt;
&lt;P&gt;ll = log((prob**m6)*((1-prob)**(1-m6)));&lt;/P&gt;
&lt;P&gt;model m6 ~ general(ll);&lt;/P&gt;
&lt;P&gt;ods select PostSummaries PostIntervals TADPanel;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 19:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Beta-Binomial-Bayesian-Model/m-p/846901#M41940</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2022-11-29T19:32:06Z</dc:date>
    </item>
  </channel>
</rss>

