search for: source_state

Displaying 4 results from an estimated 4 matches for "source_state".

Did you mean: source_stat
2017 Aug 28
0
"Improvement with the R code"
...#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 step N+1 source is dest from step N #but it would not be as readable for (k in 1:(length(data) - 1)) { source_state <- data[k] dest_state <- data[k+1] transitions[source_state, dest_state] <- transitions[source_state, dest_state] + 1 } for (k in 1:n_states) transitions[k,] <- transitions[k,] / sum(transitions[k,]) transitions } checkdf=data.frame(clusterNum=c(3,2...
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
2017 Aug 28
0
"Improvement with the R code"
...transitions <- matrix(0, n_states, n_states) >>> >>> #we could improve a little bit here because at step N+1 source is >>> dest from step N >>> #but it would not be as readable >>> for (k in 1:(length(data) - 1)) { >>> source_state <- data[k] >>> dest_state <- data[k+1] >>> transitions[source_state, dest_state] <- >>> transitions[source_state, dest_state] + 1 >>> } >>> >>> for (k in 1:n_states) >>> transitions[k,] <- tra...
2017 Aug 28
0
"Improvement with the R code"
...es) >>>>> >>>>> #we could improve a little bit here because at step N+1 source is >>>>> dest from step N >>>>> #but it would not be as readable >>>>> for (k in 1:(length(data) - 1)) { >>>>> source_state <- data[k] >>>>> dest_state <- data[k+1] >>>>> transitions[source_state, dest_state] <- >>>>> transitions[source_state, dest_state] + 1 >>>>> } >>>>> >>>>> for (k in 1:n_states...