MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Simulate a finite-state markov process

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91878] Simulate a finite-state markov process
  • From: edsferr <edsferr at uol.com.br>
  • Date: Thu, 11 Sep 2008 06:16:06 -0400 (EDT)

Dear Mark Fisher,

I've seen a message in comp.soft-sys.math.mathematica :

http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/2d5a18a5d7067ca9/066c8a2335605f1f?lnk=gst&q=finite+state#066c8a2335605f1f

I found it very interesting and tried to develop a similar program
using the same idea.

The problem is that I'm not that good with programming...

Suppose I have the following Emission matrix:

{{0.470949,0.260239,0.268812},{0.529412,0.470588,0},{0.625,0,0.375},
{0.722222,0,0.277778},{0.446667,0.24,0.313333},{0.5,0.5,0},
{0.481301,0.252846,0.265854},{0.471374,0.257634,0.270992},
{0.47293,0.269108,0.257962},{0.52027,0.239865,0.239865},
{0.595238,0.214286,0.190476},{0.444444,0.296296,0.259259},
{0.478528,0.263804,0.257669},{0.507874,0.233071,0.259055},
{0.434251,0.308869,0.256881},{0.504274,0.262108,0.233618},
{0.419753,0.320988,0.259259},{0.473684,0.315789,0.210526},
{0.512012,0.231231,0.256757},{0.5,0.19469,0.30531},
{0.390244,0.195122,0.414634},{0.510949,0.19708,0.291971},
{0.464286,0.25,0.285714},{0.285714,0,0.714286}}

The alphabet is {"A","B","C"}

And the following Transition Matrix:

{{0.470949,0,0,0,0,0,0.260239,0,0,0,0,0,0,0.268812,0,0,0,0,0,0,0,0,0,0},
{0.529412,0,0,0,0,0,0,0.470588,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0.625,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.375,0,0,0,0,0,0,0,0},
{0.722222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.277778,0,0,0,0,0,0},
{0.446667,0,0,0.24,0,0,0,0,0,0,0,0,0,0,0,0.313333,0,0,0,0,0,0,0,0},
{0.5,0,0,0,0.5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0.481301,0,0,0,0,0,0,0,0.252846,0,0,0,0,0,0.265854,0,0,0,0,0,0,0,0,0},
{0.471374,0,0,0,0,0,0,0,0,0.257634,0,0,0,0,0,0.270992,0,0,0,0,0,0,0,0},
{0.47293,0,0,0,0,0,0,0,0,0,0,0,0.269108,0,0,0,0.257962,0,0,0,0,0,0,0},
{0.52027,0,0,0,0,0,0,0,0,0,0,0,0.239865,0,0,0,0,0.239865,0,0,0,0,0,0},
{0.595238,0,0,0,0.214286,0.190476,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0.444444,0.259259,0,0,0,0,0,0,0.296296,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0.478528,0,0,0,0,0,0,0,0,0,0.257669,0,0.263804,0,0,0,0,0,0,0,0,0,0,0},
{0.507874,0,0,0,0,0,0,0.233071,0,0,0,0,0,0,0,0,0,0,0.259055,0,0,0,0,0},
{0.434251,0,0,0,0,0,0,0.308869,0,0,0,0,0,0,0,0,0,0,0,0.256881,0,0,0,0},
{0.504274,0,0,0,0,0,0,0.262108,0,0,0,0,0,0,0,0,0,0,0,0,0.233618,0,0,0},
{0.419753,0,0,0,0.320988,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.259259,0,0,0,0},
{0.473684,0,0,0,0.315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0.210526,0,0,0,0,0},
{0.512012,0,0,0,0,0,0,0.231231,0,0,0,0,0,0,0,0,0,0,0,0,0,0.256757,0,0},
{0.5,0,0,0,0.19469,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.30531,0,0},
{0.390244,0,0.195122,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.414634,0,0},
{0.510949,0,0,0,0,0,0,0,0,0,0,0.19708,0,0,0,0,0,0,0,0,0,0,0.291971,0},
{0.464286,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.285714,0.25},
{0.285714,0.714286,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}

How can I develop a program to generate x sequences of a specified
length?

By the way, does anyone know how to calculate the probability of a
specific sequence to occur within n generated sequences??

Thank you very much for your attention!

Edson Ferreira


  • Prev by Date: Re: Debugger
  • Next by Date: Importing svg files
  • Previous by thread: Re: Alternating sums of large numbers
  • Next by thread: Re: Simulate a finite-state markov process