Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

merge_states

Merge several states into one


Description

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.

Usage

merge_states(states, weight.matrix)

Arguments

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

Examples

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)

LICORS

Light Cone Reconstruction of States - Predictive State Estimation From Spatio-Temporal Data

v0.2.0
GPL-2
Authors
Georg M. Goerg <gmg@stat.cmu.edu>
Initial release
2013-11-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.