P<-matrix(c(0,1,0,0,0, 1,0,0,0,0, 1/2,0,0,1/2,0, 0,0,1/2,0,1/2, 0,1/2,0,1/2,0),ncol=5,byrow=T) Q<-P[3:5,3:5] M<-solve(diag(3)-Q) x<-matrix(c(1,1,1),ncol=1) M%*%x P<-matrix(c(0,1,0,0,0, 1/2,0,1/2,0,0, 0,1/2,0,1/2,0, 0,0,1/2,0,1/2, 0,0,0,1,0),ncol=5,byrow=T) Q<-P[-1,-1] M<-solve(diag(4)-Q) x<-matrix(c(1,1,1,1),ncol=1) M%*%x P<-matrix(c(0,1,0,0,0, 1,0,0,0,0, 1/2,0,0,1/2,0, 0,0,1/2,0,1/2, 0,1/2,0,1/2,0),ncol=5,byrow=T) Q<-P[3:5,3:5] S<-P[3:5,1:2] M<-solve(diag(3)-Q) M%*%S