Scale time series so that they can be better compared.
scale1(x, ...)# S3 method for default
scale1(x, ..., when = "first.complete", level = 1,
centre = FALSE, scale = FALSE, geometric = TRUE,
total.g = NULL)
# S3 method for zoo
scale1(x, ..., when = "first.complete", level = 1,
centre = FALSE, scale = FALSE, geometric = TRUE,
inflate = NULL, total.g = NULL)
An object of the same type as x.
a time series
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.
numeric
logical
logical or numeric
logical: if TRUE (the default), the geometric mean is
deducted with centre is TRUE; if FALSE,
the arithmetic mean is used
numeric: an annual rate at which the series is inflated (or deflated if negative)
numeric: to total growth rate (or total return) of a series
other arguments passed to methods
Enrico Schumann
This is a generic function, with methods for numeric
vectors and matrices, and zoo objects.
Schumann, E. (2025) Portfolio Management with R.
https://enricoschumann.net/PMwR/;
in particular, see
https://enricoschumann.net/R/packages/PMwR/manual/PMwR.html#scaling-series
scale1(cumprod(1 + c(0, rnorm(20, sd = 0.02))), level = 100)
Run the code above in your browser using DataLab