MCMC Technique used by Rstan

   data {
     int<lower=0> N;
     int<lower=0> K;
     matrix[N,K] y;
     matrix[N,K] X;
     matrix[K,K] omega_d;
     cov_matrix[K] L;
     vector[4] v;

  }
   parameters {
     cov_matrix[K] lambda_hat;
     vector[K] a;
   }
   transformed parameters {
      cov_matrix[K] est_Sigma;
      matrix[K,N] mu;

      
      est_Sigma=0.000001*lambda_hat*omega_d*lambda_hat;
      for (i in 1:N)
       mu[,i]=lambda_hat*X[i,]';

   }
   model {
     //sigma_0~ inv_wishart(K,diag_matrix(v));

     lambda_hat~ inv_wishart(K,L);
     a~ multi_normal(v,L);
     for (t in 1:N)
       y[t,]'~ multi_normal(a+mu[,t],est_Sigma);
   }

Can you please help me understand which MCMC algorithm rstan uses for drawing from the posteriod distribution in this case?
Also is there any way of fixing the mcmc technique to be Gibbs Sampling?

For MCMC sampling Stan always uses Hamiltonian Monte Carlo. For more, see the algorithms section of the reference manual:

2 Likes