turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- PROC MCMC for Bayesian Hierarchical Meta-Analysis

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-18-2014 06:25 AM

Hi All,

I am trying to run the Bayesian hierarchical analysis example shown here in the SAS help: SAS/STAT Software Examples: Bayesian Hierarchical Modeling for Meta-Analysis

PROC MCMC Code:

proc mcmc data=multistudies outpost=nlout seed=276 nmc=50000 thin=5

monitor=(OR Pooled);

array OR[22];

parms mu tau2;

prior mu ~ normal(0, sd=3);

prior tau2~ igamma(0.01,s=0.01);

random theta ~n(mu, var=tau2) subject=studyid;

OR[studyid]=exp(theta);

Pooled=exp(mu);

model logy ~ n(theta, var=sigma2);

run;

... but I get the following error message:

ERROR: The initial value 0 for the parameter tau2 is outside of the prior distribution support set.

NOTE: The prior of tau2 is Inv-GAMMA.

NOTE: The distribution has a support set of (0, Infinity).

NOTE: The SAS System stopped processing this step because of errors.

Can anybody enlighten me as to why this is happening? I also get an error when I change the tau2 prior to another distribution (uniform, lognormal, etc) and it only seems to work when I remove the tau2 prior altogether (which obviously isn't desirable).

I'm using SAS 9.4.

Any advice would be greatly appreciated.

Thanks,

Charles.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-18-2014 08:53 AM

Probably the easies way to get around this would be in the PARMS statement

parms mu tau2 {0.1};

The curly braces enclose an initial value, so this will move it away from the boundary of the set.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-18-2014 10:15 AM

Hi Steve,

Thanks for getting back to me. I actually tried this already but unfortunately get the following error messages:

ERROR: Invalid Operation.

ERROR: Termination due to Floating Point Exception

Does that provide any more clues as to what might be going on?

Thanks,

Charles.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-18-2014 10:22 AM

I missed that the sd for the igamma prior was 0.01, so my intial value was 10 sd away, if that is what you used. Are you certain about the parameters for the igamma? If so, then we just reached the end of my guesses as to things to try. I would say try opening a ticket with Tech Support if fiddling with the parameters of the prior doesn't help.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-18-2014 10:43 AM

Hi Steve,

I tried with 0.01 instead but alas still no luck. Will try tech support as you suggested, though I'm particularly curious because this was the code provided by the official SAS software examples on their website... so I assume it must have worked for somebody!

Thanks,

Charles.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-18-2014 10:50 AM

Any possibility of a versioning incompatibility? Tech support will hit that first, I think.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-18-2014 11:13 AM

I'm guessing that could be the reason, let's see.

Thanks again,

Charles.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-25-2014 03:11 AM

data BMA;

input id ctrl ctrlN trt trtN;

datalines;

1 3 39 3 38

2 14 116 7 114

3 11 93 5 69

4 127 1520 102 1533

5 27 365 28 355

6 6 52 4 59

7 152 939 98 945

8 48 471 60 632

9 37 282 25 278

10 188 1921 138 1916

11 52 583 64 873

12 47 266 45 263

13 16 293 9 291

14 45 883 57 858

15 31 147 25 154

16 38 213 33 207

17 12 122 28 251

18 6 154 8 151

19 3 134 6 174

20 40 218 32 209

21 43 364 27 391

22 39 674 22 680

;

run;

data BMA;

set BMA;

logy=log(trt/(trtN-trt)/(ctrl/(ctrlN-ctrl)));

sigma2=1/trt+1/(trtN-trt)+1/ctrl+1/(ctrlN-ctrl);

run;

proc mcmc data=BMA outpost=nlout seed=276 nmc=50000 thin=5

monitor=(OR Pooled);

array OR[22];

parms mu tau2;

prior mu ~ normal(0, sd=3);

prior tau2~ igamma(0.01,s=0.01);

random theta ~n(mu, var=tau2) subject=id;

OR[id]=exp(theta);

Pooled=exp(mu);

model logy ~ n(theta, var=sigma2);

run;

I am unable to run this code.

Error :

random theta ~n(mu, var=tau2) subject=id;

------

180

ERROR 180-322: Statement is not valid or it is used out of proper order.

Please help me

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-25-2014 11:07 AM

I've just copied and run your code, and got no error, clean log! One thing I suspect is that the version you use might not support the RANDOM statement. What version do you use? RANDOM statement is made available by SAS/STAT 9.3.

Funda

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-25-2014 01:28 PM

**I am using SAS 9.2. Well you are right may be,,!! I will install 9.3 soon !! I am dying to see the output..Thank you very much for ur help..**

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-25-2014 01:44 PM

While installing the newer version on your machine will guarantee access to all your products, if you download this, you can try running your code on the newest versions right now.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-25-2014 01:46 PM

Wonderful..!! Thanks a lot..!! :smileyblush: Thank you so much...