Displaying 2 results from an estimated 2 matches for "table_of_counts".
2017 Aug 28
0
"Improvement with the R code"
Hi,
I think you overthought this one a little bit, I don't know if this is the
kind of code you are expecting but I came up with something like that:
generate_transition_matrix <- function(data, n_states) {
#To be sure I imagine you should check n_states is right at this point
transitions <- matrix(0, n_states, n_states)
#we could improve a little bit here because at
2017 Aug 28
5
"Improvement with the R code"
Hello,
I am trying to implement a formula
aij= transition from state S_i to S_j/no of transition at state S_i
Code I have written is working with three state {1,2,3 }, but if the number
of states become={1,2,3,4,......n} then the code will not work, so can some
help me with this.
For and some rows of my data frame look like