Skip to contents

Package timeSeries is part of the Rmetrics suit of R packages. It provides a class, timeSeries, particularly aimed at analysis of financial data, along with many methods, functions, and utilities for statistical and financial computations on time series.

Author

Diethelm Wuertz [aut] (original code), Tobias Setz [aut], Yohan Chalabi [aut], Martin Maechler [ctb] (<https://orcid.org/0000-0002-8685-9910>), Georgi N. Boshnakov [cre, aut]

Maintainer: Georgi N. Boshnakov <georgi.boshnakov@manchester.ac.uk>

Details

The following sections have not been updated for some time.

timeSeries - S4 'timeSeries' Class

timeSeriesCreates a "timeSeries" from scratch
series, coredataExtracts the data
getUnitsExtracts the time serie units
timeExtracts the positions of timestamps
x@formatExtracts the format of the timestamp
finCenterExtracts the financial center
x@recordIDsExtracts the record IDs
x@titleExtracts the title
x@documentationExtracts the documentation

Base Time Series Functions

applyApplies a function to blocks of a "timeSeries"
cbindCombines columns of two "timeSeries" objects
rbindCombines rows of two "timeSeries" objects
diffReturns differences of a "timeSeries" object
dimreturns dimensions of a "timeSeries" object
mergeMerges two "timeSeries" objects
rankReturns sample ranks of a "timeSeries" object
revReverts a "timeSeries" object
sampleResamples a "timeSeries" object
scaleScales a "timeSeries" object
sortSorts a "timeSeries" object
startReturns start date/time of a "timeSeries"
endReturns end date/time of a "timeSeries"
endReturns end date/time of a "timeSeries"
tReturns the transpose of a "timeSeries" object
attachAttaches a "timeSeries" to the search path

Subsetting 'timeSeries' Objects

[Subsets a "timeSeries" object
[<-Assigns values to a subset
$Subsets a "timeSeries" by column names
$<-Replaces subset by column names
headReturns the head of a "timeSeries"
tailReturns the tail of a time Series
na.omitHandles NAs in a "timeSeries" object
removeNAremoves NAs from a matrix object
substituteNAsubstitutes NAs by zero, column mean or median
interpNAinterpolates NAs using R's "approx" function

Mathematical Operation

OpsS4: Arith method for a "timeSeries" object
MathS4: Math method for a "timeSeries" object
Math2S4: Maths method for a "timeSeries" object
absReturns absolute values of a "timeSeries" object
sqrtReturns square root of a "timeSeries" object
expReturns the exponential values of a "timeSeries" object
logReturns the logarithm of a "timeSeries" object
signReturns the signs of a "timeSeries" object
diffDifferences a "timeSeries" object
scaleCenters and/or scales a "timeSeries" object
quantileReturns quantiles of an univariate "timeSeries"

Methods

as.timeSeriesDefines method for a "timeSeries"
as.*.defaultReturns the input
as.*.tsTransforma a 'ts' object into a "timeSeries"
as.*.data.frameTransforms a 'data.frame' intp a 'timeSeries
as.*.characterLoads and transforms from a demo file
as.*.zooTransforms a 'zoo' object into a "timeSeries"
as.vector.*Converts univariate "timeSeries" to vector
as.matrix.*Converts "timeSeries" to matrix
as.numeric.*Converts "timeSeries" to numeric
as.data.frame.*Converts "timeSeries" to data.frame
as.ts.*Converts "timeSeries" to ts
as.logical.*Converts "timeSeries" to logical
is.timeSeriesTests for a "timeSeries" object
plotDisplays a X-Y "timeSeries" Plot
linesAdds connected line segments to a plot
pointsAdds Points to a plot
showPrints a 'timeSeries oobject

Financial time series functions

alignAligns a "timeSeries" to time stamps
cumulatedComputes cumulated series from a returns
alignDailySeriesAligns a "timeSeries" to calendarical dates
rollDailySeriesRolls a 'timeSeries daily
drawdownsComputes series of drawdowns from financial returns
drawdownsStatsComputes drawdowns statistics
durationsComputes durations from a financial time series
countMonthlyRecordsCounts monthly records in a "timeSeries"
rollMonthlyWindowsRolls Monthly windows
rollMonthlySeriesRolls a "timeSeries" monthly
endOfPeriodSeriesReturns end of periodical series
endOfPeriodStatsReturns end of period statistics
endOfPeriodBenchmarksReturns period benchmarks
returnsComputes returns from prices or indexes
returns0Computes untrimmed returns from prices or indexes
runlengthsComputes run lenghts of a "timeSeries"
smoothLowessSmoothes a "timeSeries"
smoothSplineSmoothes a "timeSeries"
smoothSupsmuSmoothes a "timeSeries"
splitsDetects "timeSeries" splits by outlier detection
spreadsComputes spreads from a price/index stream
turnsComputes turning points in a "timeSeries" object
turnsStatsComputes turning points statistics

Statistics Time Series functions

colCumsumsComputes cumulated column sums of a "timeSeries"
colCummaxsComputes cumulated maximum of a "timeSeries"
colCumminsComputes cumulated minimum of a "timeSeries"
colCumprodsComputes cumulated pruduct values by column
colCumreturnsComputes cumulated returns by column
colSumsComputes sums of all values in each column
colMeansComputes means of all values in each column
colSdsComputes standard deviations of all values in each column
colVarsComputes variances of all values in each column
colSkewnessComputes skewness of all values in each column
colKurtosisComputes kurtosis of all values in each column
colMaxsComputes maxima of all values in each column
colMinsComputes minima of all values in each column
colProdsComputes products of all values in each column
colStatsComputes statistics of all values in each column
orderColnamesReturns ordered column names of a "timeSeries"
sortColnamesReturns alphabetically sorted column names
sampleColnamesReturns sampled column names of a "timeSeries"
pcaColnamesReturns PCA correlation ordered column names
hclustColnamesReturns hierarchically clustered columnames
statsColnamesReturns statisticall rearrange columnames
orderStatisticsComputes order statistics of a "timeSeries" object
rollMeanComputes rolling means of a "timeSeries" object
rollMinComputes rolling minima of a "timeSeries" object
rollMaxComputes rolling maxima of a "timeSeries" object
rollMedianComputes rolling medians of a "timeSeries" object
rollStatsComputes rolling statistics of a "timeSeries" objectcr
rowCumsumsComputes cumulated column sums of a "timeSeries"
smoothLowessSmoothes a series with lowess function
smoothSupsmuSmoothes a series with supsmu function
smoothSplineSmoothes a series with smooth.spline function

Misc Functions

dummyDailySeriesCreates a dummy daily "timeSeries" object
isMonthlyDecides if the series consists of monthly records
isDailyDecides if the series consists of daily records
isQuarterlyDecides if the series consists of Quarterly records
descriptionCreates default description string