Programming the statistical procedures from SAS

Understanding parameter updating in PROC MCMC with hierarchical models

Posts: 25

Understanding parameter updating in PROC MCMC with hierarchical models

I am trying to understand what PROC MCMC does in terms of parameter updating (and how to control that) when I specify a hierarchical model using the random statement. All I managed to find in the SAS help on the topic was 

“The random-effects parameters associated with each subject in the same RANDOM statement are assumed to be conditionally independent of each other, given other parameters and data set variables in the model.”


Let us assume my data and model are something like the below:


data test;

unit=1; y=1; t=10; output;

unit=2; y=19; t=150; output;

unit=3; y=0; t=20; output;

unit=4; y=7; t=65; output;

unit=5; y=3; t=25; output;

unit=6; y=11; t=99; output;

unit=7; y=4; t=35; output;



proc mcmc;

  parms mu sigma 1;

  hyperprior mu ~ normal(0,sd=100);

  hyperprior sigma ~ normal(0,sd=100,lower=0);

  random u ~ normal(mu,sd=sigma) subject=unit monitor=(all);

  ll = u * y - exp(u)*t; 

  model y ~ general(ll);



Are new values for the hyperparameters (mu, sigma) and the latent random effects (u_1, u_2, ..., u_7) proposed at the same time and all accepted (or the previous values retained) at the same time?


If that is the case, what if I thought it would be the most efficient to do Gibbs sampling, i.e. 1) propose (& potentially accept) new values for (mu, sigma) conditional on the current (u_1, u_2,...,u_7), then 2) propose u_1 conditional on (mu, sigma, u_2, u_3,..., u_7), then 3) propose u_2 conditional on the others etc.?


Or is that what PROC MCMC does automatically? The SAS help information I found seems to imply that it is assumed this would be acceptable, but it is not clear whether it would do that.


What if I have two random effects on the same units (i.e. another one called "v" also with SUBJECT=unit)? Would PROC MCMC update the random effects for each unit (i.e. u_1 and v_1 together, then u_2 and v_2 together)? Or first update u_1, then u_2, etc., then u_7, then v_1, then v_2 etc.? Would this change if I assumed a multivariate normal random effect so that u_1 is a two-component vector?


Ask a Question
Discussion stats
  • 0 replies
  • 1 in conversation