#Take 100 random samples from a multivariate normal distribution
#with mean c(1, 2) and covariance matrix matrix(c(1, 0.75, 0.75, 1), nrow = 2, ncol = 2)
#for each of four chains.
my_samples_example = array(0, dim=c(2, 4, 100))
for(j in 1:4)
{
for(i in 1:100)
{
my_samples_example[,j,i] = solve(matrix(c(1, 0.75, 0.75, 1), nrow = 2, ncol = 2))%*%
rnorm(2, mean = 0, sd = 1) + matrix(c(1, 2), nrow = 2, ncol = 1, byrow = TRUE)
}
}
#The potential scale reduction factors for each parameter are close to 1
psrfdiagnostic(my_samples_example)$p_s_r_f_vec
Run the code above in your browser using DataLab