<?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: Model with PROC GENMOD + BAYES with pre-specified priors not being recognized in output in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Model-with-PROC-GENMOD-BAYES-with-pre-specified-priors-not-being/m-p/839213#M41565</link>
    <description>&lt;P&gt;The problem is the format of your Prior data set.&amp;nbsp; It should look something like the example in the documentation.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_genmod_examples10.htm" target="_blank"&gt;SAS Help Center: Bayesian Analysis of a Poisson Regression Model&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using an artificial data set, similar to your code, it would need to look something like this:&lt;/P&gt;
&lt;P&gt;data trial2;&lt;BR /&gt;seed=2534565;&lt;BR /&gt;do groupn=1 to 3;&lt;BR /&gt;do i=1 to 250;&lt;BR /&gt;logit=-2 + .05*groupn;&lt;BR /&gt;p=exp(-logit)/(1+exp(-logit));&lt;BR /&gt;if ranuni(seed)&amp;gt;p then blockn=1; else blockn=0;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;title1 "Bayesian Unadjusted Model";&lt;BR /&gt;title2 "Normal (0, 1) Priors";&lt;BR /&gt;data NormalPrior;&lt;BR /&gt;input _type_ $ Intercept groupn2 groupn3;&lt;BR /&gt;datalines;&lt;BR /&gt;Var 1e6 0.0005 1e6 &lt;BR /&gt;Mean 0.0 0.1385 0.0 &lt;BR /&gt;;&lt;BR /&gt;proc genmod data=trial2 DESCENDING ;&lt;BR /&gt;class groupn(ref="1");&lt;BR /&gt;model blockn = groupn / dist = bin &lt;BR /&gt;link = logit ;&lt;BR /&gt;&lt;BR /&gt;bayes seed=123 nbi=0 DIAG=ALL coeffprior=normal(input=NormalPrior);&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2022 15:27:03 GMT</pubDate>
    <dc:creator>SAS_Rob</dc:creator>
    <dc:date>2022-10-18T15:27:03Z</dc:date>
    <item>
      <title>Model with PROC GENMOD + BAYES with pre-specified priors not being recognized in output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Model-with-PROC-GENMOD-BAYES-with-pre-specified-priors-not-being/m-p/839206#M41564</link>
      <description>&lt;P&gt;Hi there, I am trying to run a model in the Bayesian framework using PROC GENMOD with a BAYES statement. I am specifying my priors using a data step to create a reference data set with the values of interest for my priors. However, when I call that dataset into my proc genmod + bayes using the coeffprior=normal(input=dataset), the values shown in the output are still the defaults.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output shows the "Independent Normal Prior for Regression Coefficients" table with mean=0 and precision=1e^-6, which is not equivalent to my specified variance=1. I have tried changing the input to be precision=1 in the dataset, mean to a non-zero value, and still no changes in the output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone assist me on how to get SAS to process the desired priors? I am running multiple models (both simple and multiple linear and logistic regressions). Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CODE:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;* Normal prior (0,1) PROC GENMOD USING BAYES;
data Prior; 
	input _TYPE_ $ group ; 
datalines; 
Mean 1 
Var 1 
; 
run;

title1 "Bayesian Unadjusted Model";
title2 "Normal (0, 1) Priors";
proc genmod data=dataproc.trial2 DESCENDING ;
	class groupn(ref="Fentanyl");
	model blockn = groupn / dist = bin 
							link = logit ;
	format groupn groupn_f. blockn yesno.;
	bayes seed=123 nbi=0 DIAG=ALL coeffprior=normal(input=Prior);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 605px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76276iD2B2418AA0423ECE/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOG:&lt;/P&gt;&lt;PRE&gt;26   * Normal prior (0,1) PROC GENMOD USING BAYES; run;
27   data Prior;
28       input _TYPE_ $ group ;
29   datalines;

NOTE: The data set WORK.PRIOR has 2 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


32   ;
33   run;
34
35   title1 "Bayesian Unadjusted Model of Block = Beta0+Beta1(Group)";
36   title2 "Normal (0, 1) Priors";
37   proc genmod data=dataproc.trial2 DESCENDING ;
38       class groupn(ref="Fentanyl");
39       model blockn = groupn / dist = bin
40                               link = logit ;
41       format groupn groupn_f. blockn yesno.;
42       bayes seed=123 nbi=0 DIAG=ALL coeffprior=normal(input=Prior);
43   run;

NOTE: The default sampling algorithm is the Gamerman algorithm, which is different from the
      default in SAS/STAT 9.3 and earlier releases. To revert to the previous behavior, specify
      the SAMPLING=ARMS option in the BAYES statement.
NOTE: PROC GENMOD is modeling the probability that blockn='Yes'.
NOTE: Algorithm converged.
NOTE: The scale parameter was held fixed.
NOTE: Algorithm converged.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.62 seconds
      cpu time            0.37 seconds&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Oct 2022 15:01:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Model-with-PROC-GENMOD-BAYES-with-pre-specified-priors-not-being/m-p/839206#M41564</guid>
      <dc:creator>lsandell</dc:creator>
      <dc:date>2022-10-18T15:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Model with PROC GENMOD + BAYES with pre-specified priors not being recognized in output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Model-with-PROC-GENMOD-BAYES-with-pre-specified-priors-not-being/m-p/839213#M41565</link>
      <description>&lt;P&gt;The problem is the format of your Prior data set.&amp;nbsp; It should look something like the example in the documentation.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_genmod_examples10.htm" target="_blank"&gt;SAS Help Center: Bayesian Analysis of a Poisson Regression Model&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using an artificial data set, similar to your code, it would need to look something like this:&lt;/P&gt;
&lt;P&gt;data trial2;&lt;BR /&gt;seed=2534565;&lt;BR /&gt;do groupn=1 to 3;&lt;BR /&gt;do i=1 to 250;&lt;BR /&gt;logit=-2 + .05*groupn;&lt;BR /&gt;p=exp(-logit)/(1+exp(-logit));&lt;BR /&gt;if ranuni(seed)&amp;gt;p then blockn=1; else blockn=0;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;title1 "Bayesian Unadjusted Model";&lt;BR /&gt;title2 "Normal (0, 1) Priors";&lt;BR /&gt;data NormalPrior;&lt;BR /&gt;input _type_ $ Intercept groupn2 groupn3;&lt;BR /&gt;datalines;&lt;BR /&gt;Var 1e6 0.0005 1e6 &lt;BR /&gt;Mean 0.0 0.1385 0.0 &lt;BR /&gt;;&lt;BR /&gt;proc genmod data=trial2 DESCENDING ;&lt;BR /&gt;class groupn(ref="1");&lt;BR /&gt;model blockn = groupn / dist = bin &lt;BR /&gt;link = logit ;&lt;BR /&gt;&lt;BR /&gt;bayes seed=123 nbi=0 DIAG=ALL coeffprior=normal(input=NormalPrior);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 15:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Model-with-PROC-GENMOD-BAYES-with-pre-specified-priors-not-being/m-p/839213#M41565</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2022-10-18T15:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Model with PROC GENMOD + BAYES with pre-specified priors not being recognized in output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Model-with-PROC-GENMOD-BAYES-with-pre-specified-priors-not-being/m-p/839232#M41566</link>
      <description>Thank you! So I must have a column for every level and variable in my model, within the input priors dataset, from what I gathered. I appreciate it.</description>
      <pubDate>Tue, 18 Oct 2022 16:35:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Model-with-PROC-GENMOD-BAYES-with-pre-specified-priors-not-being/m-p/839232#M41566</guid>
      <dc:creator>lsandell</dc:creator>
      <dc:date>2022-10-18T16:35:08Z</dc:date>
    </item>
  </channel>
</rss>

