sim_outlier: Simulate an outlier

Description Usage Arguments Details Value Author(s) References Examples

View source: R/sim_outlier.R

Description

Simulate an outlier

Usage

1
2
3
4
5
6
7
8
9
sim_outlier(
  n,
  k,
  freq = 12,
  type = c("AO", "LS", "TC"),
  effect_size = 10,
  start = c(2020, 1),
  multiplicative = TRUE
)

Arguments

n

Time series length

k

Number of outliers

freq

Frequency of the time series

type

Type of outlier

effect_size

Mean size of outlier

start

Start date of output time series

multiplicative

Boolean. Is multiplicative time series model assumed?

Details

Three types of outliers are implemented: AO=Additive outlier, LS=Level shift, TC=Temporary Change. The effect size is stochastic as it is drawn from a normal distribution with mean equal to the specified effect_size and a standard deviation of 1/4*effect_size. This is multiplied randomly with -1 or 1 to get negative shocks as well. If multiplicative is true, the effect size is measured in percentage. If is not true, the effect size is unit less and thus adopts the unit of the time series the outliers are added to.

Value

The function returns k time series of class xts containing the k outlier effects

Author(s)

Daniel Ollech

References

Ollech, D. (2021). Seasonal adjustment of daily time series. Journal of Time Series Econometrics. doi: 10.1515/jtse-2020-0028

Examples

1
plot(sim_outlier(60, 4, type=c("AO", "LS")))

tssim documentation built on June 25, 2021, 5:06 p.m.

Related to sim_outlier in tssim...