biwavelet

R package to conduct univariate and bivariate wavelet analyses

https://github.com/tgouhier/biwavelet

Science Score: 23.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
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 6 committers (16.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

R package to conduct univariate and bivariate wavelet analyses

Basic Info
  • Host: GitHub
  • Owner: tgouhier
  • Language: R
  • Default Branch: master
  • Homepage:
  • Size: 2.33 MB
Statistics
  • Stars: 47
  • Watchers: 5
  • Forks: 17
  • Open Issues: 20
  • Releases: 22
Created about 12 years ago · Last pushed almost 2 years ago
Metadata Files
Readme

README.Rmd

---
output:
  md_document:
    variant: markdown_github
---

```{r Setup, include=FALSE}
library(biwavelet)
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "inst/doc/webimg/README-"
)
set.seed(0)
```

# biwavelet R package

[![Build Status](https://travis-ci.org/tgouhier/biwavelet.svg)](https://travis-ci.org/tgouhier/biwavelet)
[![codecov.io](https://codecov.io/github/tgouhier/biwavelet/coverage.svg?branch=master)](https://codecov.io/github/tgouhier/biwavelet?branch=master)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/biwavelet)](http://cran.r-project.org/package=biwavelet)
![CRAN Downloads](http://cranlogs.r-pkg.org/badges/biwavelet)
[![Research software impact](http://depsy.org/api/package/cran/biwavelet/badge.svg)](http://depsy.org/package/r/biwavelet)
[![Support badge]( https://img.shields.io/badge/support-biwavelet-yellowgreen.svg)](http://stackoverflow.com/questions/tagged/biwavelet)

## Download and Install

To download the development version of the package, type the following at the R command line:
```{r Install latest, eval=FALSE}
install.packages("devtools")
devtools::install_github("tgouhier/biwavelet")
```

To download the release version of the package on CRAN, type the following at the R command line:
```{r Instal from CRAN, eval=FALSE}
install.packages("biwavelet")
```

## About biwavelet

The biwavelet R package is a port of the WTC MATLAB program written by Aslak 
Grinsted and the wavelet program written by Christopher Torrence and Gibert P.
Compo. This package can be used to perform univariate and bivariate wavelet 
analyses. Wavelet analyses are resolved in the time and frequency domains, and
thus ideal for identifying changes over time in the contribution of each
frequency (or period) of a time series.

Since version 0.14, biwavelet also plots the **bias-corrected wavelet** and
**cross-wavelet power spectrum** using the methods described by [Liu et al.
(2007)](#Liu2007) and [Veleda et al. (2012)](#Veleda2012). This correction is
needed because the traditional approach for computing the power spectrum (e.g.,
[Torrence and Compo 1998](#TorrenceCompo1998)) leads to an artificial and
systematic reduction in power at lower periods. To demonstrate this bias, we can
construct a time series by summing three sinusoidal waves each characterized by
the same power at a different period:

```{r ts_3x_sin, fig.width=8, fig.height=4}
t1 <- sin(seq(from = 0, to = 2 * 5 * pi, length = 1000))
t2 <- sin(seq(from = 0, to = 2 * 15 * pi, length = 1000))
t3 <- sin(seq(from = 0, to = 2 * 40 * pi, length = 1000))
timeseries <- t1 + t2 + t3
plot(ts(timeseries), xlab = NA, ylab = NA)
```

The wavelet spectrum of the time series should show peaks of identical power at each of the three
dominant periods. However, the traditional approach leads to a consistent reduction in power at low
periodicities:

```{r wt_bias, fig.width=8, fig.height=4.5}
wt1 <- wt(cbind(1:1000, timeseries))
par(mfrow = c(1,2))
plot(wt1, type = "power.corr.norm", main = "Bias-corrected wavelet power")
plot(wt1, type = "power.norm", main = "Biased wavelet power")
```

This bias also affects the cross-wavelet, which can be used to determine the
time- and frequency-resolved relationship between two time series. The new
version of biwavelet implements the bias-correction developed by [Veleda et al.
(2012)](#Veleda2012). The bias does not affect the wavelet coherence, however. 
For instance, MEI and NPGO undergo coherent fluctuations at periodicities of
~64-150 months (5-12 years) between 1966-2010, with peaks in NPGO leading peaks
in MEI by one quarter of a cycle. For help interpreting these results, please
see the references below and the biwavelet manual.

```{r wtc_mei_npgo, include=FALSE, cache=TRUE}
data(enviro.data)
MEI <- subset(enviro.data, select = c("date", "mei"))
NPGO <- subset(enviro.data, select = c("date", "npgo"))

# Compute wavelet coherence of MEI and NPGO using Monte Carlo randomization
wtc.mei.npgo <- wtc(MEI, NPGO)
```

```{r wtc_example, fig.width=8, fig.height=7}
# Make room to the right for the color bar
par(oma = c(0, 0, 0, 1), mar = c(5, 4, 4, 5) + 0.1)
plot(wtc.mei.npgo, plot.cb = TRUE, plot.phase = TRUE)
```



The biwavelet package can also be used to compute the (dis)similarity between
pairs of time series based on their wavelet spectrum:

![Similarity between pairs of time series based on their wavelet
spectrum](inst/doc/webimg/wclust.png)

## Additional Examples

```{r xwt_example, fig.width=8, fig.height=6}
# Sample time-series
noise1 <- cbind(1:100, rnorm(100))
noise2 <- cbind(1:100, rnorm(100))

# Cross-wavelet
xwt_noise12 <- xwt(noise1, noise2)

# Make room to the right for the color bar
par(oma = c(0, 0, 0, 1), mar = c(5, 4, 4, 5) + 0.1)
plot(xwt_noise12, plot.cb = TRUE, plot.phase = TRUE,
     main = "Cross wavelet power and phase difference (arrows)")
```

## How to cite

The R core development team and the very active community of package authors
have invested a lot of time and effort in creating R as it is today. Please give
credit where credit is due and cite R and R packages when you use them for data
analysis.

```{r Cite me}
citation("biwavelet")
```

## References


Cazelles, B., M. Chavez, D. Berteaux, F. Menard, J. O. Vik, S. Jenouvrier, and N. C. Stenseth. 2008.
**Wavelet analysis of ecological time series**.
Oecologia 156:287–304.


Grinsted, A., J. C. Moore, and S. Jevrejeva. 2004.
**Application of the cross wavelet transform and wavelet coherence to geophysical time series**.
Nonlinear Processes in Geophysics 11:561–566.


Liu, Y., X. San Liang, and R. H. Weisberg. 2007.
**Rectification of the Bias in the Wavelet Power Spectrum.**
Journal of Atmospheric and Oceanic Technology 24:2093-2102.


Rouyer, T., J. M. Fromentin, F. Menard, B. Cazelles, K. Briand, R. Pianet, B. Planque, and N. C. Stenseth. 2008.
**Complex interplays among population dynamics, environmental forcing, and exploitation in fisheries**.
Proceedings of the National Academy of Sciences 105:5420–5425.


Torrence, C., and G. P. Compo. 1998.
**A practical guide to wavelet analysis**.
Bulletin of the American Meteorological Society 79:61–78.


Torrence, C., and P. J. Webster. 1998.
**The annual cycle of persistence in the El Niño/Southern Oscillation**.
Quarterly Journal of the Royal Meteorological Society 124:1985–2004.


Veleda, D., R. Montagne, and M. Araujo. 2012.
**Cross-Wavelet Bias Corrected by Normalizing Scales**.
Journal of Atmospheric and Oceanic Technology 29:1401-1408.

## Other links
- Biwavelet listed at OpenHub: https://www.openhub.net/p/biwavelet
- Research software impact of Biwavelet (by Depsy): http://depsy.org/package/r/biwavelet

GitHub Events

Total
  • Watch event: 4
  • Issue comment event: 1
Last Year
  • Watch event: 4
  • Issue comment event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 320
  • Total Committers: 6
  • Avg Commits per committer: 53.333
  • Development Distribution Score (DDS): 0.241
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Viliam Simko v****o@g****m 243
tgouhier t****r@g****m 73
Tarik Gouhier t****k@r****l 1
Dirk Eddelbuettel e****d@d****g 1
James McCreight j****c@u****u 1
James L McCreight m****h@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 56
  • Total pull requests: 37
  • Average time to close issues: 2 months
  • Average time to close pull requests: 4 days
  • Total issue authors: 16
  • Total pull request authors: 4
  • Average comments per issue: 1.05
  • Average comments per pull request: 0.7
  • Merged pull requests: 35
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • vsimko (36)
  • tgouhier (3)
  • spencer-tassone (2)
  • dankelley (2)
  • Celine2017 (2)
  • phuongbac1212 (1)
  • atusiniida (1)
  • Losses (1)
  • clivelo (1)
  • Kaku123456789 (1)
  • Zhengpeng-1 (1)
  • Vasfocul (1)
  • ntthung (1)
  • JAFERRARI (1)
  • withr (1)
Pull Request Authors
  • vsimko (34)
  • RproEstudante (2)
  • jmccreight (1)
  • eddelbuettel (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 1,017 last-month
  • Total docker downloads: 20,392
  • Total dependent packages: 3
  • Total dependent repositories: 7
  • Total versions: 23
  • Total maintainers: 1
cran.r-project.org: biwavelet

Conduct Univariate and Bivariate Wavelet Analyses

  • Versions: 23
  • Dependent Packages: 3
  • Dependent Repositories: 7
  • Downloads: 1,017 Last month
  • Docker Downloads: 20,392
Rankings
Forks count: 4.4%
Stargazers count: 8.1%
Average: 10.1%
Dependent packages count: 10.9%
Dependent repos count: 11.1%
Docker downloads count: 12.6%
Downloads: 13.7%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • Rcpp >= 0.12.2 imports
  • fields * imports
  • foreach * imports
  • devtools * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat * suggests