Matrix-fomed Bayesian Analysis for State-space Inference and Clustering