Learn R Programming

UComp (version 5.3.1)

WEEKforecast: WEEKforecast

Description

Estimates and forecasts weekly time series with monthly and annual seasonal patterns

Usage

WEEKforecast(
  y,
  u = NULL,
  initial_date,
  h = 24,
  lambda = 1,
  criterion = "aic",
  p0 = -9999.9,
  verbose = FALSE
)

Value

An object of class UComp. It is a list containing the model specification, estimated parameters, and forecasting results.

Arguments

y

A numeric vector, ts object or list containing weekly observations of the dependent variable.

u

Optional matrix or vector of exogenous regressors. If provided, it must cover both the estimation and forecast periods.

initial_date

A character or Date object indicating the calendar start date of the series.

h

Integer indicating the forecast horizon (number of weeks ahead).

lambda

Box–Cox transformation parameter.

criterion

Information criterion used for model selection (AIC, BIC or AICc).

p0

Initial parameter vector for Maximum Likelihood estimation.

verbose

if TRUE, prints estimation details.

Author

Diego J. Pedregal

Details

WEEKforecast estimates and forecasts univariate weekly time series using Dynamic Harmonic Regression (DHR).

The function is designed for weekly data but builds the seasonal structure from underlying daily calendar information. In particular, it incorporates:

  • Monthly seasonality via harmonic terms derived from calendar months

  • Annual seasonality via multiple harmonic components based on calendar years

Standard methods applicable to UComp objects are available.

See Also

UC, UCforecast, UCfilter, UCsmooth, UCdisturb, UCcomponents

Examples

Run this code
# \donttest{
y <- rnorm(400)
m <- WEEKforecast(y, initial_date = "2015-01-01", h = 12)
# }

Run the code above in your browser using DataLab