Learn R Programming

tsgc (version 0.0)

write_results: Write a selection of relevant results to disc

Description

Function writes the following results to csv files which get saved in the location specified in res.dir: forecast new cases or incidence variable, \(y\); the filtered level and slope of \(\ln g\), \(\delta\) and \(\gamma\); filtered estimates of \(g_y\) and the confidence intervals for these estimates.

Usage

write_results(res, res.dir, Y, n.ahead, confidence.level)

Value

A number of csv files saved in the directory specified in res.dir.

Arguments

res

Results object estimated using the estimate() method.

res.dir

File path to save the results to.

Y

Cumulated variable.

n.ahead

Number of periods ahead to forecast.

confidence.level

Confidence level to use for the confidence interval on the forecasts \(\ln(g_t)\).

Examples

Run this code
# Not run as do not wish to save to local disc when compiling documentation.
# Below will run if copied and pasted into console.
library(tsgc)
library(here)

res.dir <- tempdir()
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()

tsgc::write_results(
res=res, res.dir = res.dir, Y = gauteng[idx.est], n.ahead = 14,
confidence.level = 0.68
)

Run the code above in your browser using DataLab