xsp2 is an R package that computes chi-square periodograms to predict circadian periods and assess statistical significance of rhythmicity in time series data (Sokolove & Bushell, 1978). This package builds upon and improves the original xsp package by Hitoshi Iuchi & Rikuhiro G. Yamada (2017).
While the original xsp package provides tools to compute chi-square periodograms for rhythmicity detection, xsp2 offers important enhancements for improved flexibility:
-
Flexible Binning Support:
Allows users to specify bin durations via thebin_minutesparameter, supporting a wider variety of datasets and sampling schemes. -
Customizable Period Range:
Users can define the range (periodRange) of test periods to tailor analyses to their experimental needs.
Currently, xsp2 can be installed directly from GitHub. Make sure you
have the devtools package installed:
install.packages("devtools")
library(devtools)
devtools::install_github("jaredstevens/xsp2")library(xsp2)
# Simulate 10 days of 1-minute binned activity with a 24h rhythm
bins_per_day <- 1440 # 1-min bins
n_days <- 10
t <- seq(0, n_days * 24, length.out = bins_per_day * n_days)
raw <- sin(2 * pi * t / 24) + rnorm(length(t), sd = 0.3)
counts <- round(pmax(raw, 0) * 10)
df <- data.frame(value = counts)
# Calculate chi-square periodogram
chiSqPeriodogram(df, periodRange = c(20, 28), res = 0.1, bin_minutes = 1)This package (xsp2) is released under the MIT
License.
The LICENSE file includes the full license text along with
copyright and year attribution for both:
-
The original
xsppackage by Hitoshi Iuchi (2017), and -
The new additions by Jared Stevens (2025).
CRAN does not allow full license text in the LICENSE file for
MIT-licensed packages.
Instead, a separate CRAN-specific LICENSE file is used when
submitting to CRAN, containing only the required attribution lines:
YEAR: 2017, 2025
COPYRIGHT HOLDER: Hitoshi Iuchi, Jared Stevens
For the original xsp license text, see the original xsp LICENSE
file.