I would appreciate your help.
I have a vector (e.g., x=[4 6 2 3 3 1 5 3 4] )
I need to calculate the state-transition matrix, that is, how many times does each number follow each number. In other words, what are the chances of 3 to come after 1, what are the chances of 2 to come after 5, etc.
This may seem easy in a small vector, but my vectors each have about 20,000 numbers, so an efficient system will help a lot.