2017-10-23 5 views

答えて

0

はアイデアです:

A <- matrix(c(0.75,0.25,0,0.25,0,0.75,0,0.75,0.25) , nrow = 3) 
p0 = t(matrix(c(0,0,1) , nrow = 1)) 

p = matrix(ncol = 6, nrow = 3) 
p[,1] = p0 

for (i in 2:6){ 
    p[,i] = t(A) %*% p[,i-1] 
} 

colnames(p) = paste0("p", 0:5) 
p 
#output: 
    p0 p1  p2  p3  p4  p5 
[1,] 0 0.00 0.1875 0.187500 0.2695312 0.2695312 
[2,] 0 0.75 0.1875 0.515625 0.2695312 0.4130859 
[3,] 1 0.25 0.6250 0.296875 0.4609375 0.3173828 
関連する問題