ts_examples: Principal Components, Dygraphs, Forecasts, Seasonal...

Description Usage Arguments Details Value Examples

Description

Example Functions, Generated by ts_. ts_prcomp calculates the principal components of multiple time series, ts_dygraphs generates an interactive graphical visualization, ts_forecast return an univariate forecast, ts_seas the seasonally adjusted series.

Usage

1
2
3
4
5
6
7

Arguments

x

ts-boxable time series, an object of class ts, xts, zoo, data.frame, data.table, tbl, tbl_ts, tbl_time, or timeSeries.

...

further arguments, passed to the underlying function. For help, consider these functions, e.g., stats::prcomp.

Details

With the exception of ts_prcomp, these functions depend on external packages.

Value

Usually, a ts-boxable time series, with the same class as the input. ts_dygraphs draws a plot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
ts_plot(
  ts_scale(ts_c(
    Male = mdeaths, 
    Female = fdeaths,
    `First principal compenent` = -ts_prcomp(ts_c(mdeaths, fdeaths))[, 1]
  )),
  title = "Deaths from lung diseases", 
  subtitle = "Normalized values"
)

ts_plot(ts_c(
  male = mdeaths, female = fdeaths,
  ts_forecast(ts_c(`male (fct)` = mdeaths,  `female (fct)` = fdeaths))),
  title = "Deaths from lung diseases", 
  subtitle = "Exponential smoothing forecast"
)

ts_plot(
  `Raw series` = AirPassengers,
  `Adjusted series` = ts_seas(AirPassengers),
  title = "Airline passengers", 
  subtitle = "X-13 seasonal adjustment"
)


ts_dygraphs(ts_c(mdeaths, EuStockMarkets))

christophsax/tsbox documentation built on June 26, 2018, 1:13 p.m.