Skip to contents

This function fits a dynamic linear model (DLM) to the input time series data, and produces forecasts for the specified number of periods using the INLA method.

Usage

inla_dlm(ts_data, forecast_horizon)

Arguments

ts_data

Time-series data as numeric vector

forecast_horizon

The number of periods for which forecasts are required

Value

The function returns a list with two elements:

  • obs_fitted: A numeric vector representing the fitted values over the observation period including a 7-day lag (EpiEstim).

  • pred_trend: A numeric vector representing the predicted values for the forecast horizon.

Examples

inla_dlm(c(10,12,16,18,22,26,30,34,40),5)
#> Error in inla(dlm.form, family = "gaussian", data = ts_df, control.predictor = list(compute = TRUE)): could not find function "inla"