Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

scale1

Scale Time Series


Description

Scale time series so that they can be better compared.

Usage

scale1(x, ...)

## Default S3 method:
scale1(x, ..., when = "first.complete", level = 1,
       centre = FALSE, scale = FALSE, geometric = TRUE,
       total.g = NULL)

## S3 method for class 'zoo'
scale1(x, ..., when = "first.complete", level = 1,
       centre = FALSE, scale = FALSE, geometric = TRUE,
       inflate = NULL, total.g = NULL)

Arguments

x

a time series

when

origin: for the default method, either a string or numeric (integer). Allowed strings are "first.complete" (the default), "first", and "last". For the zoo method, a value that matches the class of the index of x; for instance, with an index of class Date, when should inherit from Date.

level

numeric

centre

logical

scale

logical or numeric

geometric

logical: if TRUE (the default), the geometric mean is deducted with centre is TRUE; if FALSE, the arithmetic mean is used

inflate

numeric: an annual rate at which the series is inflated (or deflated if negative)

total.g

numeric: to total growth rate (or total return) of a series

...

other arguments passed to methods

Details

This is a generic function, with methods for numeric vectors and matrices, and zoo objects.

Value

An object of the same type as x.

Author(s)

Enrico Schumann

References

Enrico Schumann – Portfolio Management with R. http://enricoschumann.net/R/packages/PMwR/manual/PMwR.html

See Also

Examples

scale1(cumprod(1 + c(0, rnorm(20, sd = 0.02))), level = 100)

PMwR

Portfolio Management with R

v0.16-0
GPL-3
Authors
Enrico Schumann [aut, cre] (<https://orcid.org/0000-0001-7601-6576>)
Initial release
2021-01-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.