フィルターのクリア

First order Markov chains

1 回表示 (過去 30 日間)
olig
olig 2013 年 6 月 13 日
Any help would be much appreciated! What I am trying to do is produce a program that involves Markov chains. I have a vector B which contains a random sequence of numbers from 1 to 16 in the first column (corresponding to groups types) and then in the second column of vector B which contains a quantity in the group.
What I want to do is produce a transition matrix so it gives the probability of one state going to another. Take the simple example of:
B(10,1)= [ 1; 1; 3; 3; 2; 2; 3; 1; 2; 3]
B(10,2)= [1; 3; 5; 3; 2; 6; 7; 9 ;8; 6]
Only taking the 1st column into account:
So the transition of going from a 1=>1 is 1/10
So the transition of going from a 1=>2 is 1/10
So the transition of going from a 1=>3 is 1/10
So the transition of going from a 2=>1 is 0/10
So the transition of going from a 2=>2 is 1/10
So the transition of going from a 2=>3 is 2/10
So the transition of going from a 3=>1 is 1/10
So the transition of going from a 3=>2 is 1/10
So the transition of going from a 3=>3 is 1/10
The transition matrix would be output into a 3x3 matrix would be:
Trans=[0.1, 0.1, 0.1; 0.0, 0.2, 0.1; 0.1, 0.1, 0.1]
Any help would be great!

採用された回答

Youssef  Khmou
Youssef Khmou 2013 年 6 月 13 日
hi olig,
You can try to use the function "HMMESTIMATE" which a default Matlab function :
As an example, we take a sequence of numbers from 1 to 10:
seq=1:10;
The states is a matrix B with the same length as seq :
B=round(10*rand(10));
The function generates the transition and emission matrices as the following :
[Trans,Emis]=hmmestimate(seq,B)
I think this example can be adjusted to your case .

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMarkov Chain Models についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by