Time series

Practicing Statistics Interview Questions in R

Zuzanna Chmielewska

Actuary

Time series

Application of time series:

  • finance
  • agriculture
  • energy
  • etc.
Practicing Statistics Interview Questions in R

Time series

a calendar

Practicing Statistics Interview Questions in R

Time series

a calendar

Practicing Statistics Interview Questions in R

Time series

Time series analysis:

  • trends
  • seasonal variation
  • serial correlation
  • prediction model (e.g. ARIMA)
Practicing Statistics Interview Questions in R

a time series plot

Practicing Statistics Interview Questions in R

a time series plot

Practicing Statistics Interview Questions in R

a time series plot

Practicing Statistics Interview Questions in R

Time series - object

ts <- xts(x = values, order.by = dates)
Practicing Statistics Interview Questions in R
plot(ts)

plot of a time series object

Practicing Statistics Interview Questions in R

Analysis - subsetting

dates <- seq(from = as.Date("2010-01-01"),  
             to = as.Date("2010-12-31"))
Practicing Statistics Interview Questions in R

Analysis - subsetting

dates <- seq(from = as.Date("2010-01-01"),  
             to = as.Date("2010-12-31"), 
             by = "1 month")
Practicing Statistics Interview Questions in R

Analysis - subsetting

dates <- seq(from = as.Date("2010-01-01"),  
             to = as.Date("2010-12-31"), 
             by = "1 month")
ts[dates]
Practicing Statistics Interview Questions in R

Analysis - merging

time series merging

Practicing Statistics Interview Questions in R

Analysis - merging

time series merging

Practicing Statistics Interview Questions in R

Analysis - merging

time series merging

Practicing Statistics Interview Questions in R

Analysis - merging

time series merging

Practicing Statistics Interview Questions in R

Analysis - applying a function by calendar period

apply.monthly function

Practicing Statistics Interview Questions in R

Analysis - applying a function by calendar period

apply.monthly function

Practicing Statistics Interview Questions in R

Analysis - applying a function by calendar period

apply.monthly function

Practicing Statistics Interview Questions in R

Summary

  • definition of time series
  • xts object in R
  • wrangling time series:
    • subsetting
    • merging
    • functions over calendar periods
Practicing Statistics Interview Questions in R

Let's practice!

Practicing Statistics Interview Questions in R

Preparing Video For Download...