repr_lm: Regression coefficients from linear model as representation

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/model_based_repr.R

Description

The repr_lm computes seasonal regression coefficients from a linear model. Additional exogenous variables can be also added.

Usage

1
repr_lm(x, freq = NULL, method = "lm", xreg = NULL)

Arguments

x

the numeric vector (time series)

freq

the frequency of the time series. Can be vector of two frequencies (seasonalities) or just an integer of one frequency.

method

the linear regression method to use. It can be "lm", "rlm" or "l1".

xreg

the data.frame with additional exogenous regressors or the single numeric vector

Details

This model-based representation method extracts regression coefficients from a linear model. The extraction of seasonal regression coefficients is automatic. The maximum number of seasonalities is 2 so it is possible to compute representation for double-seasonal time series. The first set seasonality (frequency) is main, so for example if we have hourly time series (freq = c(24, 24*7)), the number of extracted daily seasonal coefficients is 24 and the number of weekly seasonal coefficients is 7, because the length of second seasonality representation is always freq_1 / freq_2. There is also possibility to add another independent variables (xreg).

You have three possibilities for selection of a linear model method.

Value

the numeric vector of regression coefficients

Author(s)

Peter Laurinec, <[email protected]>

References

Laurinec P, Lucka M (2016) Comparison of representations of time series for clustering smart meter data. In: Lecture Notes in Engineering and Computer Science: Proceedings of The World Congress on Engineering and Computer Science 2016, pp 458-463

Laurinec P, Loderer M, Vrablecova P, Lucka M, Rozinajova V, Ezzeddine AB (2016) Adaptive time series forecasting of energy consumption using optimized cluster analysis. In: Data Mining Workshops (ICDMW), 2016 IEEE 16th International Conference on, IEEE, pp 398-405

See Also

repr_gam, repr_exp

Examples

1
2
3
4
5
6
# Extracts 24 seasonal regression coefficients from the time series by linear model
repr_lm(rnorm(96), freq = 24, method = "lm")

# Try also robust linear models ("rlm" and "l1")
repr_lm(rnorm(96), freq = 24, method = "rlm")
repr_lm(rnorm(96), freq = 24, method = "l1")

TSrepr documentation built on June 1, 2018, 5:06 p.m.