TSrepr (version 1.0.4)

repr_lm: Regression coefficients from linear model as representation

Description

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

Usage

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

Value

the numeric vector of regression coefficients

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.

  • "lm" is classical OLS regression.

  • "rlm" is robust linear model using psi huber function and is implemented in MASS package.

  • "l1" is L1 quantile regression model (also robust linear regression method) implemented in package quantreg.

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

Laurinec P, Luck<U+00E1> M (2018) Clustering-based forecasting method for individual consumers electricity load using time series representations. Open Comput Sci, 8(1):38<U+2013>50, DOI: 10.1515/comp-2018-0006

See Also

repr_gam, repr_exp

Examples

Run this code
# NOT RUN {
# 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")

# }

Run the code above in your browser using DataLab