Markov Chain Transition Matrix: MATLAB function sparse - index exceeds matrix dimensions -


i'm referencing question: estimate markov chain transition matrix in matlab different state sequence lengths

the described procedure worked out me, i'm not able adapt last matlab command create transition matrix s = sparse(i,j,v,m,n)

transitionmatrix = sparse(uniquetransitions(:,1), uniquetransitions(:,2), p, 6,6) 

here data 18 unique transitions , corresponding probabilities:

uniquetransitions       p 5405    5414            0,046511628 5414    5420            0,046511628 5420    5420            0,139534884 5420    9999            0,046511628 5414    5430            0,046511628 5430    5414            0,023255814 5430    5191            0,023255814 5191    5462            0,023255814 5462    5414            0,023255814 5414    5414            0,139534884 5414    9999            0,023255814 5405    5419            0,023255814 5419    5419            0,162790698 5419    5412            0,069767442 5412    5419            0,046511628 5412    5414            0,023255814 5405    5405            0,046511628 5405    9999            0,046511628 

how calculate parameters 'm' , 'n'? read online matlab documentation , tried lot of parameters can't find solution.

you creating sparse matrix of size 6 6 data larger. assuming each state reachable can simple skip size argument:

transitionmatrix = sparse(uniquetransitions(:,1), uniquetransitions(:,2), p) 

it important when want create matrix last row or last column containing zeros.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -