loessf: Loess forecasting

View source: R/loess.R

loessfR Documentation

Loess forecasting

Description

Loess forecasting

Usage

loessf(
  y,
  h = 5,
  level = 95,
  span = 0.75,
  degree = 2,
  type_pi = c("bootstrap", "blockbootstrap", "movingblockbootstrap"),
  b = NULL,
  B = 250,
  type_aggregation = c("mean", "median"),
  seed = 123
)

Arguments

y

A numeric vector or time series of class ts

h

Forecasting horizon

level

Confidence level for prediction intervals

span

the parameter which controls the degree of smoothing

degree

the degree of the polynomials to be used, normally 1 or 2. (Degree 0 is also allowed, but see stats::loess)

type_pi

Type of prediction interval currently (independent) "bootstrap", (circular) "blockbootstrap", or "movingblockbootstrap"

b

block length for circular block bootstrap

B

number of bootstrap replications

type_aggregation

Type of aggregation, ONLY for bootstrapping; either "mean" or "median"

seed

reproducibility seed

Value

An object of class "forecast"; a list containing the following elements:

model

A list containing information about the fitted model

method

The name of the forecasting method as a character string

mean

Point forecasts for the time series

lower

Lower bound for prediction interval

upper

Upper bound for prediction interval

x

The original time series

residuals

Residuals from the fitted model

sims

Model simulations for bootstrapping

Examples


par(mfrow = c(3, 1))

plot(loessf(Nile, h=20, level=95, B=10))

plot(loessf(Nile, h=20, level=95, B=10,
     type_pi = "blockbootstrap"))

plot(loessf(Nile, h=20, level=95, B=10,
     type_pi = "movingblockbootstrap"))


Techtonique/ahead documentation built on Nov. 24, 2024, 10:33 a.m.