Package 'PSF'

Title: Forecasting of univariate time series using the Pattern Sequence-based Forecasting (PSF) algorithm
Description: Pattern Sequence Based Forecasting (PSF) takes univariate time series data as input and assist to forecast its future values. This algorithm forecasts the behavior of time series based on similarity of pattern sequences. Initially, clustering is done with the labeling of samples from database. The labels associated with samples are then used for forecasting the future behaviour of time series data. The further technical details and references regarding PSF are discussed in Vignette.
Authors: Neeraj Bokde, Gualberto Asencio-Cortes and Francisco Martinez-Alvarez
Maintainer: Neeraj Bokde <[email protected]>
License: GPL (>= 2)
Version: 0.3
Built: 2024-11-13 02:58:01 UTC
Source: https://github.com/neerajdhanraj/psf

Help Index


Forecasting of univariate time series using the PSF algorithm

Description

Takes an univariate time series and the prediction horizon as inputs.

Usage

psf(data, n.ahead, k = seq(2, 10), w = seq(1, 10), cycle = 24)

Arguments

data

Input univariate time series, in any format (time series (ts), vector, matrix, list, data frame).

n.ahead

The number of predicted values to be obtained.

k

The number of clusters, or a vector of candidate values to search for the optimum automatically.

w

The window size, or a vector of candidate values to search for the optimum automatically.

cycle

The number of values that conform a cycle in the time series (e.g. 24 hours per day). Only used when input data is not in time series format.

Value

A list with 3 elements:

predictions

Vector with the resulting predictions

k

Number of clusters used

w

Window size used

Examples

## Forecast the next 12 values of the univariate time series: nottem (package:datasets).
psf(nottem, 12)

## Forecast the next 48 values of the univariate time series: sunspots (package:datasets).
psf(sunspots, 48)

Plot actual and forecasted values of an univariate time series

Description

Takes an univariate time series and a vector with forecasted values.

Usage

psf_plot(data, predictions, cycle = 24, ...)

Arguments

data

Input univariate time series (in either time series (ts) or vector format). All values should be numeric.

predictions

A vector with already forecasted values.

cycle

The number of values that conform a cycle in the time series (e.g. 24 hours per day, 12 month per year, and so on). Only used when input data is not in time series (ts) format.

...

Additional graphical parameters given to plot function.

Examples

## Forecast the next 12 values of the univariate time series: nottem (package:datasets).
res <- psf(nottem, 12)

## Plot forecasted values from PSF.
psf_plot(nottem, res$predictions)