Modeling realized volatility subject to changes of regime