math {fSeries}R Documentation

Mathematical timeSeries Operations

Description

A collection and description of functions and methods dealing with mathematical timeSeries operations .

Ops.timeSeries S3: Arith method for a 'timeSeries' object,
abs Returns absolute values of a 'timeSeries' object,
sqrt Returns square root of a 'timeSeries' object,
exp Returns the exponential values of a 'timeSeries' object,
log Returns the logarithm of a 'timeSeries' object,
sign Returns the signs of 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':
Ops(e1, e2)
## S3 method for class 'timeSeries':
abs(x)
## S3 method for class 'timeSeries':
sqrt(x)
## S3 method for class 'timeSeries':
exp(x)
## S3 method for class 'timeSeries':
log(x, base = exp(1))
## S3 method for class 'timeSeries':
sign(x)
## S3 method for class 'timeSeries':
diff(x, lag = 1, diff = 1, trim = FALSE, pad = NA, ...)
## S3 method for class 'timeSeries':
scale(x, center = TRUE, scale = TRUE)
## S3 method for class 'timeSeries':
quantile(x, ...)

Arguments

base [log] -
a positive number. The base with respect to which logarithms are computed. Defaults to e=exp(1).
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.
e1, e2 [Ops] -
two objects of class timeSeries.
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.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## data - 
   # Create an artificial timeSeries object:
   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 = returnSeries(TS)
   OR
   OR > 0

[Package fSeries version 260.73 Index]