Turn on suggestions

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

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- PROC MCMC Warning

Options

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

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 04-06-2018 07:12 AM
(1678 views)

PROC MCMC is giving "WARNING: Use the RAND function with caution. The function should not be used in constructing the likelihood function or modifying model-related symbols in the program. This typically would lead to incorrect posterior inferences."

Is it a general warning or is something wrong which we have to check ?

Any guidance on this will be greatly appreciated.

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

It never hurts to post the code in question. It will avoid getting suggestions / comments involving options you already used or didn't use and may provide additional information.

I might suggest running the proc with the same input data (possibly a small set) repeatedly and see if you get the same results each time. If not you have an example of why it may not be a good idea.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks for the support offered

Please find the code,

ods graphics on;

proc mcmc data=input nmc=&nmc nbi=&nbi monitor=(_parms_ resn_pred_act resn_pred_ctrl resn_eos_act resn_eos_ctrl diff) diagnostics=(mcse autocorr ess)

statistics=(summary intervals) stats(alpha=0.20) outpost=pred;

/*** Set up the constants for the beta distributions (a and b) ***/

begincnst;

a_act=1;

b_act=1;

a_ctrl=1;

b_ctrl=1;

endcnst;

/*** Priors: distributions and initial values ***/

prior theta_act ~ beta(a_act,b_act);

prior theta_ctrl ~ beta(a_ctrl,b_ctrl);

parms theta_act 0.5 theta_ctrl 0.5;

/*** Likelihood ***/

model resn_ia_act ~ binomial(n_ia_act,theta_act);

model resn_ia_ctrl ~ binomial(n_ia_ctrl,theta_ctrl);

/*** Predicted number of responders in the remaining sample (n - n_ia)***/

resn_pred_act = rand("binomial", theta_act, n_po_act); /*_p0: post interim*/

resn_pred_ctrl = rand("binomial", theta_ctrl, n_po_ctrl);

/*** Number of responders at the end of the study = ia + pred ***/

resn_eos_act = resn_ia_act + resn_pred_act;

resn_eos_ctrl = resn_ia_ctrl + resn_pred_ctrl;

/*** Determine the probability that the difference is greater than 30% ***/

diff = theta_act - theta_ctrl;

ods output PostSummaries=posterior1 PostIntervals=posterior2;

run;

ods graphics off;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks for the support

Now with this code modification its working without any warning !!!

random resn_pred_act ~binary(theta_act) subject= n_po_act monitor=(resn_pred_act);

random resn_pred_ctrl~binary(theta_ctrl) subject=n_po_ctrl monitor=(resn_pred_ctrl);

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.