daily_sim: Create a simple, exemplary, seasonal, daily time series

Description Usage Arguments Details Author(s) Examples

View source: R/daily_sim.R

Description

Create a seasonal daily time series and its seasonal and non-seasonal components

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
daily_sim(
  n = 8,
  week_effect = 1,
  month_effect = 1,
  year_effect = 1,
  model = c(3, 1, 1),
  ar = c(-0.2, 0.5, 0.1),
  ma = -0.4,
  moving = T,
  week_cycles = 2,
  month_cycles = 3,
  year_cycles = 8
)

Arguments

n

length of time series in years

week_effect

increase size of seasonal factor for day-of-the-week

month_effect

increase size of seasonal factor for day-of-the-month

year_effect

increase size of seasonal factor for day-of-the-year

model

ARIMA model for trend and irregular component of series

ar

coefficients for AR terms

ma

coefficients for MA terms

moving

should seasonal factors be moving (=T) or constant (=F)

week_cycles

number of cycles per week

month_cycles

number of cycles per month

year_cycles

number of cycles per year

Details

The output is an xts time series containing the time series, the true seasonally adjusted series,

the day-of-the-week seasonal component, the day-of-the-month seasonal component and the

day-of-the-year seasonal component.

Author(s)

Daniel Ollech

Examples

1
2
3
time_series <- daily_sim(n=4, year_effect=3)
xtsplot(time_series[,1]) # Plot of the time series
xtsplot(time_series[,3:5]) # Plot of the seasonal factors

Example output

Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 
Try using extrafont::font_import() to load all fonts
Warning messages:
1: Use of `gg1$value` is discouraged. Use `value` instead. 
2: Use of `gg1$variable` is discouraged. Use `variable` instead. 
3: Use of `gg1$variable` is discouraged. Use `variable` instead. 
Try using extrafont::font_import() to load all fonts
Warning messages:
1: Use of `gg1$value` is discouraged. Use `value` instead. 
2: Use of `gg1$variable` is discouraged. Use `variable` instead. 
3: Use of `gg1$variable` is discouraged. Use `variable` instead. 

dsa documentation built on June 21, 2021, 9:07 a.m.