Skip to content
How to encode a Pro...
 
Notifications
Clear all

[Solved] How to encode a Probability Transition Matrix?

2 Posts
2 Users
0 Likes
1,822 Views
Avatar
Posts: 4
Customer
Topic starter
(@qsw1wpg6oem829t8ebrrh7tlyok2)
Active Member
Joined: 3 years 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
Max Henrion
Posts: 2
Admin
(@maxhenrion)
Member
Joined: 11 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

Cheers

Max

Reply
Share: