Learn R Programming

timeSeries (version 280.75)

math: Mathematical Time Series Operations

Description

Functions and methods dealing with mathematical 'timeSeries' operations. ll{ Ops-method Group 'Ops' methods for a 'timeSeries' object Math-method Group 'Math' methods for a 'timeSeries' object Math2-method Group 'Math2' methods for a 'timeSeries' object Summary-method Group 'Summary' methods for a 'timeSeries' object diff Differences a 'timeSeries' object, scale Centers and/or scales a 'timeSeries' object, quantile Returns quantiles of an univariate 'timeSeries'. }

Usage

## S3 method for class 'timeSeries':
diff(x, lag = 1, diff = 1, trim = FALSE, pad = NA, \dots)
## S3 method for class 'timeSeries':
scale(x, center = TRUE, scale = TRUE)
## S3 method for class 'timeSeries':
quantile(x, \dots)

Arguments

center, scale
[scale] - either a logical value or a numeric vector of length equal to the number of columns of x.
diff
an integer indicating the order of the difference. By default 1.
lag
an integer indicating which lag to use. By default 1.
pad
[diffSeries] - which value should get the padded values? By default NA. Another choice often used would be zero.
trim
a logical value. By default TRUE, the first missing observation in the return series will be removed.
x
an object of class timeSeries.
...
arguments to be passed.

Value

  • returns the value from a mathematical or logical operation operating on objects of class timeSeries, or the value computed by a mathematical function.

Examples

Run this code
## data - 
   # Create an artificial timeSeries object:
   setRmetricsOptions(myFinCenter = "GMT")
   charvec = timeCalendar()
   set.seed(4711)
   data = matrix(exp(cumsum(rnorm(12, sd = 0.1))))
   TS = timeSeries(data, charvec, units = "TS")
   TS

## Ops | +/- * ^ ...
   # Mathematical Operations:
   TS^2
   TS[2:4]
   OR = returns(TS)
   OR
   OR > 0

Run the code above in your browser using DataLab