roll
Fast and efficient computation of rolling and expanding statistics for time-series data.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.5%) to scientific vocabulary
Keywords
Repository
Fast and efficient computation of rolling and expanding statistics for time-series data.
Basic Info
- Host: GitHub
- Owner: jasonjfoster
- Language: C++
- Default Branch: master
- Homepage: https://jasonjfoster.r-universe.dev/roll
- Size: 682 KB
Statistics
- Stars: 117
- Watchers: 10
- Forks: 6
- Open Issues: 4
- Releases: 0
Topics
Metadata Files
README.md
roll 
Overview
roll is a package that provides fast and efficient computation of rolling and expanding statistics for time-series data.
The default algorithm in the roll package, and suitable for most applications, is an online algorithm. Based on the speed requirements and sequential nature of many problems in practice, online algorithms are a natural fit for computing rolling and expanding statistics of time-series data. That is, as observations are added and removed from a window, online algorithms update statistics and discard observations from memory (Welford, 1962; West, 1979); as a result, the amount of time to evaluate each function is significantly faster as the computation is independent of the window. In contrast, an offline algorithm requires all observations in memory to calculate the statistic for each window. Note that online algorithms are prone to loss of precision due to round-off error; hence, users can trade speed for accuracy and select the offline algorithm by setting the online argument to FALSE. Also, the RcppParallel package is used to parallelize the online algorithms across columns and across windows for the offline algorithms.
As mentioned above, the numerical calculations use the RcppParallel package to parallelize rolling and expanding statistics of time-series data. The RcppParallel package provides a complete toolkit for creating safe, portable, high-performance parallel algorithms, built on top of the Intel Threading Building Blocks (TBB) and TinyThread libraries. By default, all the available cores on a machine are used for parallel algorithms. If users are either already taking advantage of parallelism or instead want to use a fixed number or proportion of threads, then set the number of threads in the RcppParallel package with the RcppParallel::setThreadOptions function.
Installation
Install the released version from CRAN:
r
install.packages("roll")
Or the development version from GitHub:
``` r
install.packages("devtools")
devtools::install_github("jasonjfoster/roll") ```
Usage
Load the package and supply a dataset:
``` r library(roll)
n <- 15 x <- rnorm(n) y <- rnorm(n) weights <- 0.9 ^ (n:1) ```
Then, to compute rolling and expanding means, use the roll_mean function:
``` r
rolling means with complete windows
roll_mean(x, width = 5)
rolling means with partial windows
rollmean(x, width = 5, minobs = 1)
expanding means with partial windows
rollmean(x, width = n, minobs = 1)
expanding means with weights and partial windows
rollmean(x, width = n, minobs = 1, weights = weights) ```
Or use the roll_lm function to compute rolling and expanding regressions:
``` r
rolling regressions with complete windows
roll_lm(x, y, width = 5)
rolling regressions with partial windows
rolllm(x, y, width = 5, minobs = 1)
expanding regressions with partial windows
rolllm(x, y, width = n, minobs = 1)
expanding regressions with weights and partial windows
rolllm(x, y, width = n, minobs = 1, weights = weights) ```
Note that handling of missing values is supported as well (see the min_obs, complete_obs, and na_restore arguments).
References
Welford, B.P. (1962). "Note on a Method for Calculating Corrected Sums of Squares and Products." Technometrics, 4(3), 419-420.
West, D.H.D. (1979). "Updating Mean and Variance Estimates: An Improved Method." Communications of the ACM, 22(9), 532-535.
Owner
- Name: Jason Foster
- Login: jasonjfoster
- Kind: user
- Location: New York, NY
- Repositories: 2
- Profile: https://github.com/jasonjfoster
GitHub Events
Total
- Issues event: 5
- Watch event: 4
- Issue comment event: 3
- Push event: 30
Last Year
- Issues event: 5
- Watch event: 4
- Issue comment event: 3
- Push event: 30
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Jason Foster | j****r@g****m | 245 |
| Hiroaki Yutani | y****i@g****m | 1 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 2
- Total pull requests: 0
- Average time to close issues: 9 days
- Average time to close pull requests: N/A
- Total issue authors: 2
- Total pull request authors: 0
- Average comments per issue: 1.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 0
- Average time to close issues: 9 days
- Average time to close pull requests: N/A
- Issue authors: 2
- Pull request authors: 0
- Average comments per issue: 1.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- roaldarbol (2)
- ethanbsmith (2)
- pessinafederico (1)
- Beliavsky (1)
- waynelapierre (1)
- iwelch (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 4,827 last-month
- Total docker downloads: 43,390
- Total dependent packages: 9
- Total dependent repositories: 12
- Total versions: 16
- Total maintainers: 1
cran.r-project.org: roll
Rolling and Expanding Statistics
- Homepage: https://github.com/jasonjfoster/roll
- Documentation: http://cran.r-project.org/web/packages/roll/roll.pdf
- License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
-
Latest release: 1.2.0
published 6 months ago
Rankings
Maintainers (1)
Dependencies
- Rcpp * imports
- RcppParallel * imports
- covr * suggests
- testthat * suggests
- zoo * suggests
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- actions/checkout v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite