Learn R Programming

VBV (version 0.6.2)

decomposition: decomposition - decompose a time series with VBV

Description

decomposition - decompose a time series with VBV

Usage

decomposition(t.vec, p, q.vec, base.period, lambda1, lambda2)

Value

list with the following components:

  • trendA function which returns the appropriate weights if applied to a point in time

  • saisonA function which returns the appropriate weights if applied to a point in time

  • A, G1, G2Some matrices that allow to calclate SSE etc. Exposed only to reuse their calculation. See the referenced paper for details.

Arguments

t.vec

vector of observation points.

p

maximum exponent in polynomial for trend

q.vec

vector containing frequencies to use for seasonal component, given as integers, i.e. c(1, 3, 5) for 1/2pi, 3/2pi, 5/2*pi (times length of base period)

base.period

base period in number of observations, i.e. 12 for monthly data with yearly oscillations

lambda1

penalty weight for smoothness of trend

lambda2

penalty weight for smoothness of seasonal component (lambda1 == lambda2 == Inf result in estimations of the original Berliner Verfahren)

Examples

Run this code
### Usage of decomposition
t <- 1:121 # equidistant time points, i.e. 5 days
p <- 2     # maximally quadratic
q <- c(1, 3, 5)   # 'seasonal' components within the base period
base.period <- 24 # i.e. hourly data with daily cycles
l1 <- 1    
l2 <- 10

dec <- decomposition( t, p, q, base.period, l1, l2)
### Note: decomosition is independent of data, only depends on time

Run the code above in your browser using DataLab