我已经在R中从矩阵绘制了一个马尔可夫链。然而,我有许多小于0.01的概率,因此我的概率图看起来像这样:
我已经搜索了几个小时,但似乎找不到一种方法可以显示所有4位小数。是否有任何格式化方法或者我应该保持原样?
我的代码如下:
library(markovchain)
newtransition.matrix <- matrix( data = c(
.9366, .0066, .0007, .0003 ,.0003, 0, .0015, 0,
.0583, .9172, .0225, .0026, .0006, .001, 0, 0,
.004, .0694, .9176, .0483, .0044, .0032, .0029, 0,
.0009, .0049, .0518, .8924, .0666, .0046, .0088, 0,
.0002, .0006, .0049, .0444, .8323, .0572, .0191, 0,
0, .0009, .002, .0081, .0746, .8362, .1028, 0,
0, .0002, .0001, .0016, .0105, .0384, .6123, 0,
0, .0002, .0004, .0023, .0107, .0594, .2526, 1),
nrow = 8, ncol = 8,
dimnames = list( c( "AAA", "AA", "A", "BBB", "BB", "B", "CCC", "Default" ), c( "AAA", "AA", "A", "BBB", "BB", "B", "CCC", "Default") ) )
print( newtransition.matrix )
newtransition.matrix <- new( "markovchain", transitionMatrix = newtransition.matrix )
layout <- matrix(c(-3, 1, 2, 2, 2, -2, 4, 1, 0, 6, 0, -6, -3, -4, 3, -4), ncol = 2, byrow = TRUE)
plot(newtransition.matrix, vertex.size = 10, layout = layout, edge.arrow.size=0.25)
许多感谢!