Learn R Programming

loadshaper (version 1.1.1)

lscore: Load Shape Score

Description

lscore provides a diagnostic score for evaluating the derived load shape in retaining time series properties.

Usage

lscore(ls, type = "acf", output = 2, lag = NULL)

Arguments

ls

An object of class lslin or lslog, created using function lslin or lslog

type

Type of correlation to be evaluate, either "acf" or "pacf"

output

Type of output to be used, either 1 or 2; uses ls$y if 1 and ls$y2 if 2

lag

Maximum lag at which to calculate the acf or pacf. Same as lag.max in acf. If Null, then default is used.

Value

A list of the followings:

  • wmape: Weighted MAPE.

  • lag: Lags at which ACF or PACF values were evaluated and used in calculating wmape.

  • type: Type of Correlation (ACF or PACF)

  • cor_x: ACF/PACF values of the original load.

  • cor_y: ACF/PACF values of the derived load.

  • weight: Weights at different lags used to calculate wmape.

Details

The diagnostic measure is calculated as a weighted mean absolute percent error (MAPE) of auto correlation or partial auto correlation values of the derived series with respect to the original. The values are calculated for given lag. Lag = 0 is omitted from calculation for auto correlation as it would be always 1. If \(o_i\) and \(d_i\) are the correlation values of original and derived load shape at lag \(i\), then weighted MAPE is calculated as

$$wmape = \sum _{i=1}^{lag} { w_i * |(o_i - d_i) / o_i|}$$ where \(w_i = \frac{|o_i|}{\sum _{i=1}^{lag}|o_i|}\)

Since wmape is a measure of error, lower value indicates better preservation of time series property.

Examples

Run this code
# NOT RUN {
loads <- ercot[ercot$Year == 2019, ]$COAST
linear_loadshape <- lslin(loads, target_lf = 0.4)
# --------------
scores_1 <- lscore(linear_loadshape, type = "acf", lag = 20)
print(scores_1)
# --------------
scores_2 <- lscore(linear_loadshape, type = "pacf")
print(scores_2)







# }

Run the code above in your browser using DataLab