Description Usage Arguments Examples
This function merges states i_1, …, i_j into a new, single state i_1 by adding corresponding columns of the weight matrix (\mathbf{W}_{i_1} = \mathbf{W}_{i_1} + … + \mathbf{W}_{i_j}) and removing columns i_2, …, i_j.
1 | merge_states(states, weight.matrix)
|
states |
vector of length 1 ≤q j ≤q K with the states i_1, …, i_j \subset \lbrace 1, …, K \rbrace that should be merged; no repeating state labels allowed. |
weight.matrix |
N \times K weight matrix |
1 2 3 4 5 6 7 8 9 10 11 12 13 | set.seed(10)
WW <- matrix(c(rexp(1000, 1/10), runif(1000)), ncol = 5, byrow = FALSE)
WW <- normalize(WW)
image2(WW, density = TRUE)
## Not run:
merge_states(c(1, 1, 5), WW) # error since states were repeated
## End(Not run)
WW_new <- merge_states(c(1, 3, 5), WW)
par(mfrow = c(1, 2), mar = c(1, 1, 2, 1))
image2(WW, main = paste(ncol(WW), "states"), legend = FALSE)
image2(WW_new, main = paste(ncol(WW_new), "states"), legend = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.