BookmarkSubscribeRSS Feed
csfcgua
Calcite | Level 5

t Hello,

I put a Model in Proc MCMC, and set one of the parameters as Dirichlet prior:

Proc MCMC Data=test ...... ;

   Parms Y X;

   Array X[3] x1 x2 x3;

   Array P[3] p1 p2 p3;

      Model A1 ~ normal( Y + x1, sd=1);

      Model A2 ~ normal( Y + x2, sd=1);

      Model A3 ~ normal( Y + x3, sd=1);

             

               Prior Y ~ beta(....);

               Prior X ~ Dirichlet(P);

Run;  

SAS kept telling me that "The name X is already defined as a variable and cannot be redeclared as an array by the ARRAY statement"

But if I delete the Array statement, SAS showed ERROR: The DIRICHLET distribution must be applied to an array.

This is very frustrating. Can somebody please tell me how to fix this problem? Thanks.

3 REPLIES 3
Ksharp
Super User

Then use another name

Proc MCMC Data=test ...... ;

   Parms Y X;

   Array XX[3] x1 x2 x3;

   Array P[3] p1 p2 p3;

      Model A1 ~ normal( Y + x1, sd=1);

      Model A2 ~ normal( Y + x2, sd=1);

      Model A3 ~ normal( Y + x3, sd=1);

            

               Prior Y ~ beta(....);

               Prior X ~ Dirichlet(P);

Run; 

csfcgua
Calcite | Level 5

Thanks.

But both X and P  in dirichlet must be declared as array.

charlie26
Calcite | Level 5

I ran into the same problem. Any solution? Thanks in advance!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Discussion stats
  • 3 replies
  • 1417 views
  • 0 likes
  • 3 in conversation