MathGroup Archive 2003

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

Search the Archive

Re: simulating a 2-state Markov process

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41370] Re: simulating a 2-state Markov process
  • From: TCoxDenver at aol.com
  • Date: Fri, 16 May 2003 06:45:05 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 5/15/2003 5:29:14 PM Mountain Daylight Time, 
deb at alceon.com writes:

> <<Can someone please suggest an efficient way to use Mathematica to 
> draw realizations from a 2-state Markov process as outlined below?>>

At each time step, sample from a uniform U[0, 1] distribution.  If you are in 
state H and the sampled value is no greater than p, then go to T, else stay 
in H.  Similarly, if you are in T and the sampled value is no greater than q, 
go to H, else stay in T.

All you need is a binary variable to show which state you are in now (1 = H, 
0 = T) and a uniform random number generator and you are ready to go.

-- Tony



  • Prev by Date: Re: MatrixForm, decided not to work anymore....
  • Next by Date: Re: Help using variables with subscripts
  • Previous by thread: Biokmod
  • Next by thread: simulating a 2-state Markov process