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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1407 views
  • 0 likes
  • 3 in conversation