I have the following vector in R :
p = c(1/4,1/8,1/6,1/16,3/16,1/12,1/8);p
which has length 7.
I want to c.reate a matrix that will be N times N, where here N=7 but th. e the entries to be with metropolis Hastings algorithm.
As the picture suggests:
So r(x,y)=1/7
and p(x,y) =r(x,y) \min(\frac{\pi(y)}{\pi(x)},1)
For example the p(1,2) = 1/7 \cdot \min(\frac{1/8}{1/4},1) =1/14
p(1,3) = 1/7 \cdot \min(\frac{1/6}{1/4},1) =2/21 apart from the entry p(1,1) = 1-\sum_{i=2}^{j=7}p(i,j).
This sum will be in all the diagonal entries.
r = 1/7
r*min(p[2]/p[1],1)
Any help ?