This repository contains all necessary code to replicate the results, figures and tables of Haimerl, Paul, and Tobias Hartl. 2023. "Modeling COVID-19 Infection Rates by Regime-Switching Unobserved Components Models" Econometrics 11, no. 2: 10. https://doi.org/10.3390/econometrics11020010
If you use any parts of this code, please cite this paper.
- Replicate_paper.Rmd: R-Notebook that guides you through all the necessary steps to replicate the paper
- R: Folder containing R scripts
- src: Folder holding Rcpp functions
- Output: Model outputs (to be created)
To set up the regime-switching unobserved components (UC) model, let
The trend
The seasonal component
The cyclical component
where
The regime indicator
To robustify our findings, we further introduce several extensions to this approach (see section 4).
Among other, we include a specification that substitutes the deterministic seasonal component
$\gamma^{UR}t = -\sum^6{j=1} \gamma^{UR}{t-j} + x_t, \quad (1 - L^7) x_t = \omega_t, \quad \omega_t \sim i.i.d.N(0, \sigma^2{\omega})$.
Furthermore, we consider a regime process that incorporates a third state
Lastly, even though not shown in the paper, we investigate specifications that (i) allow for endogeneity between the trend and regime processes, (ii) regime-dependent heteroscedasticity in either
Turning to the endogenous specification, innovations to the trend and regime processes may exhibit a non-zero correlation
For further details, see sections 2 and 4.
The following table provides an overview of all implemented models as well as their respective specifications. A ✅ indicates a non-zero value or the respective extension being implemented. To use any of these specifications, define modelSpec
in Chunk 2 of the notebook as one of the abbreviations. Note that the trailing dot must be included. Model specific functions can be found in R/Models/
2 Regime processes ( |
|||||||||
---|---|---|---|---|---|---|---|---|---|
D.Seas. | ✅ | ✅ | |||||||
D.Seas.C. | ✅ | ✅ | |||||||
D.Seas.C.3St. | ✅ | ✅ | ✅ | ||||||
D.Seas.2P.TVarSw. | ✅ | ✅ | ✅ | ✅ | |||||
UR.Seas. | ✅ | ✅ | |||||||
UR.Seas.C. | ✅ | ✅ | |||||||
UR.Seas.En. | ✅ | ✅ | ✅ | ||||||
UR.Seas.TVarSw. | ✅ | ✅ | ✅ | ||||||
UR.Seas.CVarSw. | ✅ | ✅ | ✅ | ||||||
UR.Seas.2P.TVarSw. | ✅ | ✅ | ✅ | ✅ | |||||
UR.Seas.2P.CVarSw. | ✅ | ✅ | ✅ | ✅ |
Engel, C., & Kim, C.-J. (1999). The Long-Run U.S./U.K. Real Exchange Rate. Journal of Money, Credit and Banking, 31(3), 335–356. https://doi.org/10.2307/2601115
Kang, K. H. (2014). Estimation of state-space models with endogenous Markov regime-switching parameters. The Econometrics Journal, 17(1), 56–82. http://www.jstor.org/stable/43697655
Kim, C.-J., Piger, J., & Startz, R. (2008). Estimation of Markov regime-switching regression models with endogenous switching. Journal of Econometrics, 143(2), 263–273. https://doi:10.1016/j.jeconom.2007.10.002