I am studying one implementation of MCMC in SAS
here https://support.sas.com/documentation/cdl/en/statug/67523/HTML/default/viewer.htm#statug_mcmc_examples13.htm
It implements
proc mcmc data=seeds outpost=postout seed=332786 nmc=20000;
ods select PostSumInt;
parms beta0 0 beta1 0 beta2 0 beta3 0 s2 1;
prior s2 ~ igamma(0.01, s=0.01);
prior beta: ~ general(0);
w = beta0 + beta1*seed + beta2*extract + beta3*seed*extract;
random delta ~ normal(w, var=s2) subject=ind;
pi = logistic(delta);
model r ~ binomial(n = n, p = pi);
run;
I fail to understand what are the purposes of the codeline ods select PostSumInt;
and declaration parms beta0 0 beta1 0 beta2 0 beta3 0 s2 1;
i.e. beta0 0
? Are they starting values?
Also there seems to no definition of priors for beta
coefficients, but I see there is one general definition prior beta: ~ general(0);
How beta
here is linked to beta0, beta1
etc and what is general(0)
?
I really appreciate for any clarification on above codes.
In order of your questions:
ods select
will send whatever output that is named to the active ODS destination(s). It is the inverse of ods exclude
, and by default all output will be shown unless it's been disabled earlier. In this case ODS will only receive the PostSumInt
table. Each PROC has documentation on the output tables it produces, here you'll see that PostSumInt
is 'basic posterior statistics'. You can submit ods trace on
to get log feedback on ODS output.parms
provides initializing values as you guessed. In addition parameters that are part of the same parms
statement are updated together, so this can affect convergence efficiency.beta:
is SAS syntax for 'everything starting with beta
' (specifically defined parameters here), so the prior statement indeed acts on all beta parameters. You can use such naming much more broadly, also in data steps etc., see the link.It's not super straightforward to search, but the SAS documentation explains all of this.