# Generating Markov Chains

• Aug 14th 2007, 01:09 PM
jklm1664
Generating Markov Chains
I'm looking for a way to get a program to generate a markov chain for me. It's a big task, which is why I need help. So far, I have gotten Mathematica to generate all possible subsets of n for a set of r, and I wanted to rename them and somehow get it to generate the probability of going from, say, a to b, then a to c, then a to d...then a to n in one step, so I could get one row, then do this for each row, then combine them to get a matrix.
I could do this by hand, sure, but when it gets up to 20x20 and larger I'd rather not be inputting 400 separate numbers...
I'm not too good in the advanced mathematics department, so I would appreciate it if anybody could be of help.
Also, I would appreciate it if you think you can be of help if you would IM me at JuliaLeigh10.
I have Mathematica and R, I just find Mathematica tons easier to use, but I'd be willing to use either of them. I just want to get this done!
• Aug 14th 2007, 02:33 PM
CaptainBlack
Quote:

Originally Posted by jklm1664
I'm looking for a way to get a program to generate a markov chain for me. It's a big task, which is why I need help. So far, I have gotten Mathematica to generate all possible subsets of n for a set of r, and I wanted to rename them and somehow get it to generate the probability of going from, say, a to b, then a to c, then a to d...then a to n in one step, so I could get one row, then do this for each row, then combine them to get a matrix.
I could do this by hand, sure, but when it gets up to 20x20 and larger I'd rather not be inputting 400 separate numbers...
I'm not too good in the advanced mathematics department, so I would appreciate it if anybody could be of help.
Also, I would appreciate it if you think you can be of help if you would IM me at JuliaLeigh10.
I have Mathematica and R, I just find Mathematica tons easier to use, but I'd be willing to use either of them. I just want to get this done!

I think we will need more information about the process that is giving rise to the transition matrix etc.

RonL
• Aug 14th 2007, 03:25 PM
jklm1664
Well, for all I know, there's a much easier way to do this, but all that I'm actually trying to do is make a transition matrix for any n choose r.
Thanks
• Aug 14th 2007, 03:37 PM
Plato
Quote:

Originally Posted by jklm1664
Well, for all I know, there's a much easier way to do this, but all that I'm actually trying to do is make a transition matrix for any n choose r.
Thanks

We can be sure that you have in your brain a clear understanding of what you are asking. However, I agree with CaptainBlack, your question is meaningless to me and I have taught Markov Chains. Markov Chains are about the probabilities of transitions states. Hence his question to you: describe the process of the transition.
• Aug 14th 2007, 04:30 PM
jklm1664
Sorry, I don't really know how to get myself across.
I need to generate transition matrices of one step of any set n choose any subset r, say, the matrix for 4 choose 2 would have the states a = (1,2), b=(1,3) c=(1,4), d=(2,3), e=(2,4), f=(3,4) with a 6x6 matrix of (0,.25,.25,.25,.25,0),
(.25,0,.25,.25,0,.25),
(.25,.25,0,0,.25,.25),
(.25,.25,0,0,.25,.25),
(.25,0,.25,.25,0,.25),
(0,.25,.25,.25,.25,0)

(All the same # with 0's along both diagonals, if I got it right...there must be some easy way to tell mathematica to do that? Multiple a number by a diagonal matrix and then a reverse diagonal matrix or some such?)

I'm sorry, as I said, I'm not very good at this.