Programming the statistical procedures from SAS

proc mcmc with iwish prior and UN@AR(1) covariance

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

proc mcmc with iwish prior and UN@AR(1) covariance

[ Edited ]

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;

 


Accepted Solutions
Solution
‎06-11-2018 10:30 AM
SAS Employee
Posts: 97

Re: proc mcmc with iwish prior and UN@AR(1) covariance

Posted in reply to Robert_Kozarski

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


All Replies
Solution
‎06-11-2018 10:30 AM
SAS Employee
Posts: 97

Re: proc mcmc with iwish prior and UN@AR(1) covariance

Posted in reply to Robert_Kozarski

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.

New Contributor
Posts: 2

Re: proc mcmc with iwish prior and UN@AR(1) covariance

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;

  

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 137 views
  • 0 likes
  • 2 in conversation