BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Robert_Kozarski
Calcite | Level 5

Hi All,

 

What does exactly the IWISHDWM addition to the proc mcmc options? Looks to me it imposes the Random Walk Metropolis (RW-Metropolis) sampler on posterior with iwish prior. I could not find any documentation about that.

 

I am fitting bivariate mixed model for longitudinal data (3 repeated measurements) with UN&AR(1) covariance. Without IWISHRWM the posteriors for all Sigmas are flat and Ind-Metropolis sampler gets chosen by default. Application of IWISHRWM solves it - the model converges to its proc mixed equivalent.

 

See below for the code; SAS version 9.04.01M3P062415.

 

Thanks,

Robert

 

proc mcmc data=ardata_wide_mcmc seed=1234 nbi=1000 nmc=10000 thin=10 plots=ALL IWISHRWM outpost=MODEL_bivar_UNAR1;
array Y[6] Y1_1 Y1_2 Y1_3 Y2_1 Y2_2 Y2_3;
array Mu[6];
array B0[2] B01 B02;
array B1[2] B11 B12;
array V1[2] V11 V12;
array V2[2] V21 V22;
array COV[6,6]; 
array S[2,2];
array Sigma[2,2];
CALL IDENTITY (S); parms B0: B1: V1: V2: Sigma {0.1 0.001 0.001 0.1} Rho 0.1; prior B0: B1: V1: V2: ~ normal(0, var=1e6); prior Sigma ~ iwish(%eval(2+1), S); prior Rho ~ uniform(-1,1); /* Kronecker product matrix */ beginnodata; do i = 1 to 6; do j = 1 to 6; if (i <= 3 and j <= 3) then do; COV[i,j] = Sigma[1,1] * Rho**abs(i-j); end; if (i > 3 and j <= 3) then do; COV[i,j] = Sigma[1,2] * Rho**abs((i-3)-j); end; if (i <= 3 and j > 3) then do; COV[i,j] = Sigma[2,1] * Rho**abs(i-(j-3)); end; if (i > 3 and j > 3) then do; COV[i,j] = Sigma[2,2] * Rho**abs(i-j); end; end; end; endnodata; Mu[1] = B01 + B11 * X_1 + V11; Mu[2] = B01 + B11 * X_2 + V12; Mu[3] = B01 + B11 * X_3; Mu[4] = B02 + B12 * X_1 + V21; Mu[5] = B02 + B12 * X_2 + V22; Mu[6] = B02 + B12 * X_3; model Y ~ mvn(Mu, COV); run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Rob
SAS Employee

Yes, the IWISHRWM option essentially applies the RW algorithm when you have a IWISH posterior.  In general the option remains undocumented because in anything larger than a 2x2 case, it tends not to work very well.

View solution in original post

2 REPLIES 2
SAS_Rob
SAS Employee

Yes, the IWISHRWM option essentially applies the RW algorithm when you have a IWISH posterior.  In general the option remains undocumented because in anything larger than a 2x2 case, it tends not to work very well.

Robert_Kozarski
Calcite | Level 5

Thank you for your response.

 

What would you suggest for cases larger than [2,2]? I plan to carry out the analysis for UN@UN where the TIGMA is [3,3] with IWISH prior (relevant part of the code below). From what I get right now I can see the Sigma and Tigma do not converge to proc mixed outcome with IWISHRWM.

 

Thanks a lot,

Robert

 

array S[2,2];
array Sigma[2,2];
array T[3,3];
array Tigma[3,3];

%***Set up some expandable code to create required matricies for inverse wishart prior;
CALL IDENTITY (S);
CALL IDENTITY (T);

parms Sigma {0.1 0.01 0.01 0.1};
parms Tigma {1 0.01 0.01 0.01 1 0.01 0.01 0.01 1};
parms B0: B1: V1: V2:;

prior B0: B1: V1: V2: ~ normal(0, var=1e6);
prior Sigma ~ iwish(%eval(2 + 1), S);
prior Tigma ~ iwish(%eval(3 + 1), T);

/* Kronecker product matrix */
beginnodata; 
	do i = 1 to 6; 
		do j = 1 to 6;
			if (i <= 3 and j <= 3) then do;
				COV[i,j] = Sigma[1,1] * Tigma[i,j]; 
			end;			
			if (i > 3 and j <= 3) then do;
				COV[i,j] = Sigma[1,2] * Tigma[(i-3),j]; 
			end;
			if (i <= 3 and j > 3) then do;
				COV[i,j] = Sigma[2,1] * Tigma[i,(j-3)]; 
			end;
			if (i > 3 and j > 3) then do;
				COV[i,j] = Sigma[2,2] * Tigma[(i-3),(j-3)]; 
			end;
		end; 
	end; 
endnodata;

  

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 1484 views
  • 0 likes
  • 2 in conversation