I want to enter in R the following matrix (transition probability) but something I make wrong and the output is not right.
The matrix is in the picture :
my effort is the following :
n=100
A = matrix(c(0),n+1,n+1);A
A[1,2] = 1/4
A[1,1] = 3/4
A[2,1] = 1/4
A[2,2] = 1/2
A[2,1] = 1/4
for (k in 2:n) {
A[k,k+1] = 1/4
A[k,k] = 1/2
A[k,k-1] = 1/6
A[k,k-2] = 1/12
A[n,n] = 3/4
A[n,n-1] = 1/6
A[n,n-2] = 1/12}
A
pA = A
for (i in 10000){
pA = pA %*% A }
pA
but the resulting columns (first 3 columns) must be: 0.2087, 0.1652, 0.1307
Any help?