Test function
##test
p=matrix(c(.5,.5,.25,.25,0,.25,.25,.5,.5),nrow=3)
u_1 <- matrix(c(1/3,1/3,1/3),ncol=3)
u_2 <- matrix(c(.2,.6,.2),ncol=3)
u_3 <- matrix(c(0,1,0),ncol=3)
ozzify(p=p,u_1,n=10)
## [,1] [,2] [,3]
## [1,] 0.4 0.2 0.4
## [2,] 0.4 0.2 0.4
## [3,] 0.4 0.2 0.4
## [,1] [,2] [,3]
## [1,] 0.4 0.2 0.4
## [,1] [,2] [,3]
## [1,] 0.4 0.2 0.4
## [2,] 0.4 0.2 0.4
## [3,] 0.4 0.2 0.4
## [,1] [,2] [,3]
## [1,] 0.4 0.2 0.4
## [,1] [,2] [,3]
## [1,] 0.4 0.2 0.4
## [2,] 0.4 0.2 0.4
## [3,] 0.4 0.2 0.4
## [,1] [,2] [,3]
## [1,] 0.4 0.2 0.4
- Being that the matrices converge very rapidly, starting value makes no difference at n of 10.
- Logically thinking about it if a matrices column has the same values, than the dot product of a vector which adds to 1(total probability=1), will always be the same value as that vector.
Apply to harvard example
harv_p=matrix(c(.8,.3,.2,.2,.4,.1,0,.3,.7),nrow=3)
ozzify(p=harv_p,n=8,u=u_2)
## [,1] [,2] [,3]
## [1,] 0.5555556 0.2222222 0.2222222
## [2,] 0.5555556 0.2222222 0.2222222
## [3,] 0.5555556 0.2222222 0.2222222
## [,1] [,2] [,3]
## [1,] 0.5555556 0.2222222 0.2222222