TimeSeriesClassRMetrics {QRMlib} | R Documentation |
A collection and description of functions and methods dealing with regular and irregular 'timeSeries' objects. Dates and times are implemented as 'timeDate' objects. Included are functions and methods for the generation and representation of 'timeSeries' objects, and for mathematical operations.
The functions and methods for the Generation of 'timeSeries' Objects are:
‘timeSeries()’ | Creates a 'timeSeries' object from scratch, |
‘read.timeSeries()’ | Reads a ‘timeSeries’ from a spreadsheet file, |
‘as.timeSeries()’ | S3: Creates ‘time Series’ from a ‘matrix’, |
‘is.timeSeries()’ | S3: Tests if an object is of class a ‘timeSeries’, |
‘print.timeSeries()’ | S3: Print method for a ‘timeSeries’ object, |
‘plot.timeSeries()’ | S3: Plot method for a ‘timeSeries’ object, |
‘lines.timeSeries()’ | S3: Lines method for a ‘timeSeries’ object, |
‘Ops.timeSeries()’ | S3: Arith method for a ‘timeSeries’ object, |
‘[.timeSeries()’ | S3: “[” method for a ‘timeSeries’ object, |
‘head.timeSeries()’ | S3: returns the head of a ‘timeSeries’ object, |
‘tail.timeSeries()’ | S3: returns the tail of a ‘timeSeries’ object. |
The functions and methods for the Representation of ‘timeSeries’ Objects are:
‘seriesData()’ | Extracts data slot from a 'timeSeries', |
‘seriesPositions()’ | Extracts positions slot from a 'timeSeries', |
‘start.timeSeries()’ | S3: Extracts start date of a 'timeSeries', |
‘end.timeSeries()’ | S3: Extracts end date of a 'timeSeries', |
‘as.vector.timeSeries()’ | S3: Converts a 'timeSeries' to a vector, |
‘as.matrix.timeSeries()’ | S3: Converts a 'timeSeries' to a matrix, |
‘as.data.frame.timeSeries()’ | S3: Converts a 'timeSeries' to a data.frame. |
The functions and methods for Math Operations of 'timeSeries' Objects are:
‘applySeries()’ | Applies a function to margins of a ‘timeSeries’, |
‘alignDailySeries()’ | Aligns a daily ‘timeSeries’ to new positions, |
‘window()’ | Selects a piece from a ‘timeSeries’ object, |
‘merge()’ | Merges a ‘timeSeries’ object with a ‘matrix’, |
‘ohlcDailyPlot()’ | Plots open high low close bar chart, |
‘revSeries()’ | Reverts the order of ‘timeSeries’ object, |
‘diffSeries()’ | Takes differences from a ‘timeSeries’ object, |
‘lagSeries()’ | Lags a ‘timeSeries’ object, |
‘outlierSeries()’ | Removes outliers from a ‘timeSeries’ object, |
‘returnSeries()’ | Computes returns from a ‘timeSeries’ object, |
‘logSeries()’ | Returns logarithms of a ‘timeSeries’ object, |
‘absSeries()’ | Returns absolute values of a ‘timeSeries’ object. |
Functions calls include:
timeSeries(data, charvec, units = NULL, format = "ISO", zone = "GMT",
FinCenter = myFinCenter, recordIDs = data.frame(), title = NULL,
documentation = NULL, ...)
read.timeSeries(file, zone = "GMT", FinCenter = "", title = "",
documentation = "", sep = ";")
as.timeSeries(x, dimnames = TRUE, format = "")
is.timeSeries(object)
The following are S3 method for class 'timeSeries':
print(x, ...)
plot(x, reference.grid = TRUE, lty = 1, ...)
lines(x, ...)
Ops(e1, e2)
x[i = min(1, nrow(x@Data]):nrow(x@Data),
j = min(1, ncol(x@Data)):ncol(x@Data))
head(x, ...)
tail(x, ...)
seriesData(object)
seriesPositions(object)
The following are S3 method for class 'timeSeries':
start(x, ...)
end(x, ...)
as.vector(x, mode = "any")
as.matrix(x)
as.data.frame(x, row.names = NULL, optional = NULL)
applySeries(x, from = NULL, to = NULL, by=c("monthly","quarterly"), FUN = colAvgs, units = NULL, ...);
window(x, from, to);
diffSeries(x, lag = 1, diff = 1, trim = FALSE, pad = NA);
lagSeries(x, k = 1, trim = FALSE, units = NULL);
outlierSeries(x, sd = 10, complement = TRUE);
merge(x, y, units = NULL);
returnSeries(x, type = c("continuous", "discrete"), percentage = FALSE,
trim = TRUE, digits = 4, units = NULL);
revSeries(x);
logSeries(x);
absSeries(x);
alignDailySeries(x, method = c("before", "after", "interp", "fillNA"),
include.weekends = FALSE, units = NULL);
ohlcDailyPlot(x, volume = TRUE, colOrder = c(1:5), units = 1e6,
xlab = c("Date", "Date"), ylab = c("Price", "Volume"),
main = c("O-H-L-C", "Volume"), grid.nx = 7, grid.lty = "solid", ...);
Generation of Time Series Objects:
We have defined a timeSeries class which is in many aspects
similar to the S-Plus class with the same name, but has also
some important differences. The class has seven Slots, the
‘Data’ slot which holds the time series data in matrix form,
the ‘position’ slot which holds the time/date as a character
vector, the ‘format’ and ‘FinCenter’ slots which are the same
as for the ‘timeDate’ object, the ‘units’ slot which holds
the column names of the data matrix, and a ‘title’ and a
‘documentation’ slot which hold descriptive character strings.
Date and time is managed in the same way as for timeDate objects.
documentation by Scott Ulman for R-language distribution