ts_index: Indices from Levels or Percentage Rates

Description Usage Arguments Value Examples

View source: R/ts_index.R

Description

ts_index returns an index series, with value of 1 at base date. ts_compound builds an index from percentage change rates, starting with 1 and compounding the rates.

Usage

1
2
3
ts_compound(x, denominator = 100)

ts_index(x, base = NULL)

Arguments

x

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

denominator

numeric, set equal to one if percentage change rate is given a decimal fraction

base

base date, character string, Date or POSIXct, at which the

Value

a ts-boxable time series, with the same class as the input.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
head(ts_compound(ts_pc(ts_c(fdeaths, mdeaths))))
head(ts_index(ts_df(ts_c(fdeaths, mdeaths)), "1974-02-01"))

ts_plot(
  `My Expert Knowledge` = ts_chain(
    mdeaths, 
    ts_compound(ts_bind(ts_pc(mdeaths), 15, 23, 33))),
  `So Far` = mdeaths,
  title = "A Very Manual Forecast"
)

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