Programming the statistical procedures from SAS

can't assign an Array in a Dirichlet prior, but SAS requires a vector for Dirichlet

Reply
New Contributor
Posts: 4

can't assign an Array in a Dirichlet prior, but SAS requires a vector for Dirichlet

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.

Grand Advisor
Posts: 9,451

Re: can't assign an Array in a Dirichlet prior, but SAS requires a vector for Dirichlet

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; 

New Contributor
Posts: 4

Re: can't assign an Array in a Dirichlet prior, but SAS requires a vector for Dirichlet

Thanks.

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

New User
Posts: 1

Re: can't assign an Array in a Dirichlet prior, but SAS requires a vector for Dirichlet

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

Ask a Question
Discussion stats
  • 3 replies
  • 252 views
  • 0 likes
  • 3 in conversation