BookmarkSubscribeRSS Feed
Digicha1
Fluorite | Level 6

Hello,

I'm running a repeated measures model in PROC MCMC with the aim to produce both treatment differences (three treatment arms) and LS-Mean equivalents at each visit. I'm assuming non-informative priors for now, but will incorporate an informative prior for treatment as a sensitivity. I have two questions:

 

  1. Can I obtain LS-Mean equivalent posteriors in PROC MCMC? If so, how do I obtain the L coefficient matrix without using PROC MIXED's coef dataset?
  2. Will my choice of prior affect the L coefficient matrix, or is the matrix only determined by the likelihood?

I have an example code which includes two treatment variables (D1 (Trt1 vs Trt3) and D2 (Trt2 vs Trt3), and baseline score (base). Any help on generating posterior Means or LSMeans for each treatment by visit would be appreciated.

 

proc mcmc data=data seed=1000 nmc=10000 nbi=100 outpost=fixout ntu=100 stats(alpha=0.05) thin = 10 statistics=all dic   diag = (mcse autocorr ess)
        monitor=(_PARMS_ v1d1 v2d1 v3d1 v4d1 v5d1 v6d1 v1d2 v2d2 v3d2 v4d2 v5d2 v6d2);
ods output PostSummaries=BF;
array Y[6] Madrsv1 Madrsv2 Madrsv3 Madrsv4 Madrsv5 Madrsv6;
array Mu[6];
array Cov[6,6];
array V[6] V1-V5 0;
array S[6,6];
array Va[6] Va1-Va5 0;
array Vb[6] Vb1-Vb5 0;
 
parms B0-B3 Cov;
parms V1-V5;
parms Va1-Va5 Vb1-Vb5;
 
 
prior B0 B1 B2 B3 Va1 Va2 Va3 Va4 Va5 V1-V5 Vb1-Vb5 ~ normal(0, var=1e6);
prior Cov ~ iwish(6,S);
 
begincnst;
   call identity(S);
endcnst;
Mn = B0 + B1*D1 + B2*D2 + B3*Base;
do i = 1 to 6;
   Mu[i] = Mn + V[i] + D1*Va[i] + D2*Vb[i];
end;
model Y ~ mvn(Mu, Cov);
 
*Treatment difference estimates at each visit;
 
 v1d1 = (B1 + Va1) ;
v2d1 = (B1 + Va2) ;
v3d1 = (B1 + Va3) ;
v4d1 = (B1 + Va4) ;
v5d1 = (B1 + Va5) ;
v6d1 = (B1) ;
 
 v1d2 = (B2 + Vb1) ;
v2d2 = (B2 + Vb2) ;
v3d2 = (B2 + Vb3) ;
v4d2 = (B2 + Vb4) ;
v5d2 = (B2 + Vb5) ;
v6d2 = (B2) ;
4 REPLIES 4
SAS_Rob
SAS Employee

You would need to create a data set with the coefficients in them and then use the PREDDIST statement with the COVARIATES= option.

I am not sure how the priors would change the coefficients as those are meant to be just a linear combination of the parameters applied to the posterior predictive distribution.

Digicha1
Fluorite | Level 6

Hi Rob,

 

Thank you for sharing! Would you be able to share an example of the dataset I need to create? I require the individual treatment means for each visit - would it be using the array terms?

JackieJ_SAS
SAS Employee

Try enclosing the contrasts with BEGINNODATA and ENDNODATA statements:

beginnodata; 
v1d1 = (B1 + Va1) ;
v2d1 = (B1 + Va2) ;
v3d1 = (B1 + Va3) ;
v4d1 = (B1 + Va4) ;
v5d1 = (B1 + Va5) ;
v6d1 = (B1) ;
 
 v1d2 = (B2 + Vb1) ;
v2d2 = (B2 + Vb2) ;
v3d2 = (B2 + Vb3) ;
v4d2 = (B2 + Vb4) ;
v5d2 = (B2 + Vb5) ;
v6d2 = (B2) ;
endnodata;
Digicha1
Fluorite | Level 6

Hi JackieJ,

 

Apologies I forgot to copy that from my code originally. However the v1d1 etc only produce the treatment comparisons at a visit rather than the individual treatment means which I am also after. B1 is the comparison between Trt1 and Trt3 at Visit 1, is there a way I could just obtain the Mean for Trt1 at Visit 1 and not the difference?

 

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore 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
  • 4 replies
  • 1843 views
  • 2 likes
  • 3 in conversation