Regime switching models are usually used in finance, as it is assumed that there is an unobserved market state (let's call it market sentiment) that governs stock prices. This market sentiment can be loosely associated to a bull or a bear market.
Regime switching in financial data via HMM
Getting ready
The depmixS4 package needs to be installed using install.packages("depmixS4").
How to do it...
In the following recipe, we will work with the returns for the Pampa Energia S.A. ADR stock prices:
- First, we load the data and the necessary packages, and we calculate...