In recent decades, diabetes has become a serious disease affecting a large number of people. Although there is no cure for diabetes, it can be managed. Especially, with the advance in sensor technology, lots of data may lead to the improvement of patient diabetes management, if properly mined. However, there usually exists noise or errors in the observed behavioral data which poses challenges for extracting meaningful knowledge. To overcome this challenge, we propose to learn the latent state which represents the patient’s condition. Such states should be inferred from the behavioral data but unknown a priori. In this paper, we propose a novel framework to capture the trajectory of latent states for patients from behavioral data while exploiting their demographic difference and similarities to other patients. We conduct hypothesis testing to illustrate the importance of the demographic data in diabetes management, and validate that each behavioral feature follows an exponential or a Gaussian distribution. Integrating these aspects, we propose a restricted hidden Markov model (RHMM) to estimate the trajectory of latent states by integrating the demographic and behavioral data. In RHMM, the latent state is mainly determined by the previous state and the demographic features in a nonlinear way. Markov Chain Monte Carlo techniques are used for model parameter estimation. Experimental results on synthetic and real datasets demonstrate that the proposed RHMM is effective in diabetes management.