I'm using the markovchain
package in R and the function
mc<-markovchainFit(data)
I have a propablity matrix mc$estimate
and I want to round the propabilities. How do I do that?
Another question: How I can write that matrix to text file or Excel?
I have matrix like this:
mc$estimate
MLE Fit
A 22 - dimensional discrete Markov Chain with following states
A B C D E F G H I J K L M N O P Q R S T Y Z
The transition matrix (by rows) is defined as follows
A B C D E F
A 0.468053492 0.008172363 0.028974740 0.014858841 0.023031204 0.063150074
B 0.003191489 0.590425532 0.020212766 0.019148936 0.011702128 0.102127660
C 0.004054198 0.001707031 0.817134322 0.015896725 0.004374267 0.017497066
D 0.004519774 0.006214689 0.052824859 0.505367232 0.024011299 0.035310734
E 0.005132930 0.001710977 0.005396157 0.010002632 0.698078442 0.068570676
F 0.001155435 0.001386522 0.002195326 0.001675381 0.007683642 0.903347873
G 0.004933473 0.002690985 0.014800419 0.012856929 0.020032890 0.073105098
H 0.005486028 0.004114521 0.016629522 0.022458426 0.035487742 0.053317332
I 0.007445734 0.002271580 0.020570419 0.021327612 0.031423523 0.028899546
J 0.011885111 0.003796633 0.024430505 0.021294156 0.015351601 0.056949488
K 0.008743754 0.001784440 0.022127052 0.026945039 0.021234832 0.070663812
L 0.003227759 0.003026024 0.012507565 0.014726649 0.016743998 0.052854549
M 0.007148954 0.002560819 0.013551003 0.014511310 0.015258216 0.067008109
N 0.010998878 0.002918070 0.018406285 0.025140292 0.029405163 0.073400673
O 0.003787879 0.001578283 0.003787879 0.008207071 0.006313131 0.067866162
P 0.000000000 0.000000000 0.000000000 0.007518797 0.000000000 0.007518797
Q 0.005144695 0.004501608 0.003215434 0.012861736 0.013504823 0.052733119
R 0.009460298 0.003566998 0.022797767 0.024193548 0.015973945 0.095068238
I would round that whit 2 desimals and then write to Excel or text file. How it is possible?