Learn R Programming

tsgc (version 0.0)

forecast_peak: Returns forecast of number of periods until peak given KFAS::KFS output.

Description

Since Harvey and Kattuman (2021) show that $$g_{y,t+\ell|T} = \exp\{\delta_{T|T}+\ell \gamma_{T|T}\}+\gamma_{T|T},$$ we can compute the \(\ell\) for which \(g_{y,t}=0\) and then will fall below zero. This \(\ell\) is given by $$\ell = \frac{\ln(-\gamma_{T|T})-\delta_{T|T}}{\gamma_{T|T}}.$$ This is predicated on \(\gamma_{T|T}<0\), else there is super-exponential growth and no peak in sight. Of course, it only makes sense to investigate an upcoming peak for \(g_{y,T|T}>0\) (when cases are growing). The estimates of \(\delta_{T|T}\) and \(\gamma_{T|T}\) are extracted from the KFS object passed to the function.

Usage

forecast_peak(kfs_out)

Value

Forecast of number of periods until peak.

Arguments

kfs_out

The KFAS::KFS object for which the forecast peak is to be calculated. This would be the output element of a model estimated in the SSModelDynamicGompertz or SSModelDynamic

Examples

Run this code
library(tsgc)
data(gauteng,package="tsgc")
idx.est <- zoo::index(gauteng) <= as.Date("2020-07-06")

res <- SSModelDynamicGompertz$new(Y = gauteng[idx.est], q = 0.005)$estimate()

forecast_peak(res$output)

Run the code above in your browser using DataLab