Title: | Rcpp Bindings for Algorithms for Unevenly Spaced Time Series |
---|---|
Description: | Algorithms and operators for unevenly-spaced time series are provided based on the 'UTS' library by Andreas Eckner. |
Authors: | Dirk Eddelbuettel |
Maintainer: | Dirk Eddelbuettel <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.0.1 |
Built: | 2024-11-04 04:03:28 UTC |
Source: | https://github.com/eddelbuettel/rcpputs |
Algorithms and operators for unevenly-spaced time series are provided based on the 'UTS' library by Andreas Eckner.
The DESCRIPTION file:
Package: | RcppUTS |
Type: | Package |
Title: | Rcpp Bindings for Algorithms for Unevenly Spaced Time Series |
Version: | 0.0.1 |
Date: | 2018-06-04 |
Author: | Dirk Eddelbuettel |
Maintainer: | Dirk Eddelbuettel <[email protected]> |
Description: | Algorithms and operators for unevenly-spaced time series are provided based on the 'UTS' library by Andreas Eckner. |
License: | GPL (>= 2) |
Imports: | Rcpp (>= 0.12.17) |
LinkingTo: | Rcpp |
Suggests: | xts |
RoxygenNote: | 6.0.1 |
Repository: | https://eddelbuettel.r-universe.dev |
RemoteUrl: | https://github.com/eddelbuettel/rcpputs |
RemoteRef: | HEAD |
RemoteSha: | 82485ad74f00b635ac10c6486d7d0e574b0d393a |
Index of help topics:
EMAnext EMA functions for unevenly spaced time series RcppUTS-package Rcpp Bindings for Algorithms for Unevenly Spaced Time Series SMAnext SMA functions for unevenly spaced time series rollingCentralMoment Rolling operations functions for irregularly spaced time series utsExample Irregularly spaced time series example
This section should provide a more detailed overview of how to use the package, including the most important functions.
Dirk Eddelbuettel
Maintainer: Dirk Eddelbuettel <[email protected]>
This optional section can contain literature or other references for background information.
Optional links to other man pages
## Optional simple examples of the most important functions ## Use \dontrun{} around code to be shown but not executed
## Optional simple examples of the most important functions ## Use \dontrun{} around code to be shown but not executed
The UTS library by Andreas Eckner provides algorithms for unevenly spaced time-series data. This package brings a few of them to R. The functions describe here offer exponentially-decaying weighted moving average, or EMA, for short. Three variants are provides considering the last or next observation relative to time âtâ, as well as linear interpolation between them.
EMAnext(times, values, tau) EMAlast(times, values, tau) EMAlinear(times, values, tau)
EMAnext(times, values, tau) EMAlast(times, values, tau) EMAlinear(times, values, tau)
times |
A Datetime vector |
values |
A numeric vector |
tau |
A double with the decay factor |
A numeric vector with EMA-weighted values. package at the given position is available.
Dirk Eddelbuettel for the package, Andreas Eckner for the underlying code.
if (requireNamespace("xts", quietly=TRUE)) { suppressMessages(library(xts)) times <- ISOdatetime(2010, 1, 2, 8, 30, 0) + c(0, 1.0, 1.2, 2.3, 2.9, 5.0) values <- seq(0, 10, by=2) plot(xts(values, order.by=times), type="b", main="Series and last/next/linear EMAs", major.ticks="auto", grid.ticks.on="auto") lines(xts(EMAlast(times,values, 1), values, order.by=times), type="b", col="lightblue") lines(xts(EMAnext(times,values, 1), values, order.by=times), type="b", col="darkblue") lines(xts(EMAlinear(times,values, 1), values, order.by=times), type="b", col="mediumblue") addLegend("topleft", legend.names=c("series", "EMAlast", "EMAnext", "EMAlinear"), lty=rep(1,4), lwd=rep(1,4), col=c("black", "lightblue", "darkblue", "mediumblue")) }
if (requireNamespace("xts", quietly=TRUE)) { suppressMessages(library(xts)) times <- ISOdatetime(2010, 1, 2, 8, 30, 0) + c(0, 1.0, 1.2, 2.3, 2.9, 5.0) values <- seq(0, 10, by=2) plot(xts(values, order.by=times), type="b", main="Series and last/next/linear EMAs", major.ticks="auto", grid.ticks.on="auto") lines(xts(EMAlast(times,values, 1), values, order.by=times), type="b", col="lightblue") lines(xts(EMAnext(times,values, 1), values, order.by=times), type="b", col="darkblue") lines(xts(EMAlinear(times,values, 1), values, order.by=times), type="b", col="mediumblue") addLegend("topleft", legend.names=c("series", "EMAlast", "EMAnext", "EMAlinear"), lty=rep(1,4), lwd=rep(1,4), col=c("black", "lightblue", "darkblue", "mediumblue")) }
The UTS library by Andreas Eckner provides algorithms for unevenly spaced time-series data. This package brings a few of them to R. The functions describe here offer various rolling operators.
rollingCentralMoment(times, values, widthbefore, widthafter, moment) rollingMax(times, values, widthbefore, widthafter) rollingMean(times, values, widthbefore, widthafter) rollingMedian(times, values, widthbefore, widthafter) rollingMin(times, values, widthbefore, widthafter) rollingNobs(times, values, widthbefore, widthafter) rollingProduct(times, values, widthbefore, widthafter) rollingSD(times, values, widthbefore, widthafter) rollingSum(times, values, widthbefore, widthafter) rollingSumStable(times, values, widthbefore, widthafter) rollingVar(times, values, widthbefore, widthafter)
rollingCentralMoment(times, values, widthbefore, widthafter, moment) rollingMax(times, values, widthbefore, widthafter) rollingMean(times, values, widthbefore, widthafter) rollingMedian(times, values, widthbefore, widthafter) rollingMin(times, values, widthbefore, widthafter) rollingNobs(times, values, widthbefore, widthafter) rollingProduct(times, values, widthbefore, widthafter) rollingSD(times, values, widthbefore, widthafter) rollingSum(times, values, widthbefore, widthafter) rollingSumStable(times, values, widthbefore, widthafter) rollingVar(times, values, widthbefore, widthafter)
times |
A Datetime vector |
values |
A numeric vector |
widthbefore |
A double with the preceding observation width |
widthafter |
A double with the subsequent observation width |
moment |
A double with the requested moment. |
A numeric vector with the corresponding result.
Dirk Eddelbuettel for the package, Andreas Eckner for the underlying code.
The UTS library by Andreas Eckner provides algorithms for unevenly spaced time-series data. This package brings a few of them to R. The functions describe here offer simple moving average, or SMA, for short. Three variants are provides considering the last or next observation relative to time âtâ, as well as linear interpolation between them.
SMAnext(times, values, widthbefore, widthafter) SMAlast(times, values, widthbefore, widthafter) SMAlinear(times, values, widthbefore, widthafter)
SMAnext(times, values, widthbefore, widthafter) SMAlast(times, values, widthbefore, widthafter) SMAlinear(times, values, widthbefore, widthafter)
times |
A Datetime vector |
values |
A numeric vector |
widthbefore |
A double with the preceding observation width |
widthafter |
gvA double with the subsequent observation width |
A numeric vector with SMA-weighted values. package at the given position is available.
Dirk Eddelbuettel for the package, Andreas Eckner for the underlying code.
if (requireNamespace("xts", quietly=TRUE)) { suppressMessages(library(xts)) times <- ISOdatetime(2018, 6, 7, 8, 30, 0) + c(0, 1.0, 1.2, 2.3, 2.9, 5.0) values <- seq(0, 10, by=2) plot(xts(values, order.by=times), type="b", main="Series and last/next/linear SMAs", major.ticks="auto", grid.ticks.on="auto") lines(xts(SMAlast(times,values, 2.5, 1), values, order.by=times), type="b", col="lightblue") lines(xts(SMAnext(times,values, 2.5, 1), values, order.by=times), type="b", col="darkblue") lines(xts(SMAlinear(times,values, 2.5, 1), values, order.by=times), type="b", col="mediumblue") addLegend("topleft", legend.names=c("series", "SMAlast", "SMAnext", "SMAlinear"), lty=rep(1,4), lwd=rep(1,4), col=c("black", "lightblue", "darkblue", "mediumblue")) }
if (requireNamespace("xts", quietly=TRUE)) { suppressMessages(library(xts)) times <- ISOdatetime(2018, 6, 7, 8, 30, 0) + c(0, 1.0, 1.2, 2.3, 2.9, 5.0) values <- seq(0, 10, by=2) plot(xts(values, order.by=times), type="b", main="Series and last/next/linear SMAs", major.ticks="auto", grid.ticks.on="auto") lines(xts(SMAlast(times,values, 2.5, 1), values, order.by=times), type="b", col="lightblue") lines(xts(SMAnext(times,values, 2.5, 1), values, order.by=times), type="b", col="darkblue") lines(xts(SMAlinear(times,values, 2.5, 1), values, order.by=times), type="b", col="mediumblue") addLegend("topleft", legend.names=c("series", "SMAlast", "SMAnext", "SMAlinear"), lty=rep(1,4), lwd=rep(1,4), col=c("black", "lightblue", "darkblue", "mediumblue")) }
The UTS library by Andreas Eckner provides algorithms for unevenly spaced time-series data. This package brings a few of them to R. This function shows the original example.
utsExample()
utsExample()
Nothing
Dirk Eddelbuettel for the package, Andreas Eckner for the underlying code.
utsExample()
utsExample()