Clear all

[Solved] How to encode a Probability Transition Matrix?

Posts: 4
Topic starter
Active Member
Joined: 11 months ago

How do you encode a probability transition matrix, which is a probability of going from State A to State B?

The issue here is that I can only use the State index once.  I need it twice.

1 Reply
Posts: 2
Joined: 9 years ago

An array may only use an Index once to identify a dimension. In Analytica, you identify indexes of a multidimensional array by the name of the index, rather than position (which is common in other languages). But there's a simple way to address your problem -- where you want to create a 2D matrix indexed by original State and Next State.  Given that you have an Index State, you define a second index,

      INDEX NextState := CopyIndex(State)

You can then define the matrix as, say of transition probabilities as:

      Variable TransitionProb := Table(State, NextState)(....)

See more details on the Analytica wiki at CopyIndex



Scroll to Top