Package {ConsensusCPA}


Type: Package
Title: Consensus-Based Change-Point Analysis Using Multiple Statistical Tests
Version: 0.1.0
Maintainer: S. Vishnu Shankar <S.vishnushankar55@gmail.com>
Description: Provides a unified framework for detecting change points in univariate time series using multiple statistical methods, including Pettitt's test, Buishand Range test, Buishand U test, and the Standard Normal Homogeneity Test (SNHT). The package summarizes individual test results, determines a consensus change point using majority, median, or weighted agreement approaches, exports results with graphical comparisons of observations for before and after the detected change point. The methodology is further described in Laasya et al. (2026) <doi:10.1007/s11069-025-07783-2>.
License: GPL-3
Encoding: UTF-8
Depends: R (≥ 4.1.0)
Imports: dplyr, ggplot2, rlang, trend, openxlsx, zoo
Config/roxygen2/version: 8.1.0
NeedsCompilation: no
Packaged: 2026-08-17 15:25:51 UTC; JARVIS
Author: S. Vishnu Shankar [aut, cre], Santosha Rathod [aut], Mrinmoy Ray [aut], Anil Kumar [aut], V. Lavanya [aut], Prabhat Kumar [aut]
Repository: CRAN
Date/Publication: 2026-08-24 14:50:13 UTC

Consensus-Based Change-Point Analysis

Description

Provides a unified framework for detecting change points in univariate time series using multiple statistical methods, including Pettitt's test, Buishand Range test, Buishand U test, and the Standard Normal Homogeneity Test (SNHT). The package summarizes individual test results, determines a consensus change point using majority, median, or weighted agreement approaches, exports results with graphical comparisons of observations for before and after the detected change point.

Usage

ConsensusCPA(
  Data,
  methods = c("Pettitt", "Buishand_Range", "Buishand_U", "SNHT"),
  consensus = c("Majority", "Median", "Weighted"),
  missing = c("omit", "mean", "median", "linear"),
  min_n = 10,
  verbose = TRUE,
  export_excel = FALSE,
  excel_file = NULL,
  save_plot = FALSE,
  plot_file = NULL
)

Arguments

Data

A data frame or matrix where the first column contains the time variable (e.g., Year) and the remaining columns contain the time series for different variables or districts.

methods

Character vector specifying the change-point detection methods to apply. Available options are "Pettitt", "Buishand_Range", "Buishand_U", and "SNHT".

consensus

Character string specifying the consensus approach. Options are "Majority", "Median", and "Weighted".

missing

Character string specifying the method for handling missing values. Options are "omit", "mean", "median", and "linear".

min_n

Minimum number of observations required for analysis.

verbose

Logical; if TRUE, prints progress messages and displays the final results.

export_excel

Logical. If TRUE, exports results to an Excel file.

excel_file

Name of the Excel output file.

save_plot

Logical. If TRUE, saves the plot as a PNG image.

plot_file

Character string specifying the path of the output PNG image. Required only when save_plot = TRUE.

Value

A list containing:

References

Laasya, K. N. V. L., Kallakuri, S., Rathod, S., Neelima, T. L., Chakraborty, D., Shankar, S. V., Ray, M., Paul, N. C., Saleem, S., Kumar, A. T., Bandumula, N., Baral, K., Reddy, K. S., and Kumar, A. (2026). Statistical investigation of heatwave trends and change points in Telangana, India. doi:10.1007/s11069-025-07783-2

Examples

data <- data.frame(
  Year = 2001:2020,
  District_A = c(10, 11, 10, 12, 13, 12, 14, 15, 16, 15,
                 18, 19, 20, 21, 20, 22, 23, 24, 25, 26),
  District_B = c(8, 9, 10, 9, 11, 12, 11, 13, 14, 15,
                 16, 15, 17, 18, 19, 20, 21, 22, 23, 24)
)

result <- ConsensusCPA(data)
result