Thanks to visit codestin.com
Credit goes to github.com

Skip to content

zetian-jia/Reliable-change-index-RCI-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RCI: Reliable Change Index

R-CMD-check CRAN status Lifecycle: stable License: MIT

Overview

The RCI package provides robust tools for calculating the Reliable Change Index, a statistical method used to determine whether changes in test scores between two time points represent true change beyond measurement error.

The RCI is particularly valuable in:

  • πŸ₯ Clinical Psychology: Evaluating treatment effectiveness
  • 🧠 Neuropsychology: Assessing cognitive changes post-intervention
  • πŸ’Š Medical Research: Monitoring disease progression or recovery
  • πŸ“Š Longitudinal Studies: Detecting meaningful individual-level changes

Key Features

βœ… Robust Input Validation: Comprehensive error checking and informative messages
βœ… Missing Data Handling: Gracefully manages NA values
βœ… Modular Design: Clean, testable, and maintainable codebase
βœ… Extensive Documentation: Detailed help files and vignettes
βœ… Comprehensive Testing: 100% test coverage with testthat
βœ… Statistical Rigor: Implements Jacobson & Truax (1991) methodology

Installation

From GitHub (Development Version)

# Install devtools if not already installed
if (!require("devtools")) install.packages("devtools")

# Install RCI from GitHub
devtools::install_github("Jiazetian/Reliable-change-index-RCI-", subdir = "RCI")

From CRAN (Stable Release - Coming Soon)

install.packages("RCI")

Quick Start

Basic Usage

library(RCI)

# Example: Clinical depression scores (BDI-II)
baseline <- c(28, 32, 25, 30, 27, 29, 31, 26, 28, 30)  # Pre-treatment
followup <- c(12, 15, 10, 14, 11, 13, 16, 9, 12, 14)   # Post-treatment

# Calculate RCI
rci_scores <- calculate_rci(baseline, followup)
print(rci_scores)
#>  [1] -8.32 -8.85 -7.80 -8.32 -8.32 -8.32 -7.80 -8.85 -8.32 -8.32

# Identify statistically significant changes (95% CI)
significant_change <- abs(rci_scores) > 1.96
print(significant_change)
#>  [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE

# All patients showed statistically reliable improvement! βœ“

Interpretation Guide

The RCI values indicate the magnitude and direction of change:

RCI Value Interpretation (95% CI)
> +1.96 Significant deterioration
-1.96 to +1.96 No reliable change
< -1.96 Significant improvement

Note: Negative RCI values in this example indicate improvement (lower scores = better).

Advanced Example: Handling Missing Data

# Real-world data often has missing values
baseline <- c(25, 28, NA, 30, 27, 29, NA, 26)
followup <- c(15, 18, 12, NA, 14, 16, 13, NA)

rci_scores <- calculate_rci(baseline, followup)
print(rci_scores)
#> [1] -5.20 -5.20   NA   NA -6.76 -6.76   NA   NA

# RCI gracefully handles NAs - correlation calculated from complete pairs only

Extracting Diagnostic Information

baseline <- c(15, 18, 20, 16, 17, 18, 19, 19, 16, 17)
followup <- c(30, 27, 25, 28, 26, 29, 30, 27, 25, 28)

rci_scores <- calculate_rci(baseline, followup, conf_level = 0.95)

# Access diagnostic attributes
reliability <- attr(rci_scores, "reliability")
se_measurement <- attr(rci_scores, "se_measurement")
critical_value <- attr(rci_scores, "critical_value")

cat("Test-retest reliability (r):", round(reliability, 3), "\n")
cat("Standard error of measurement:", round(se_measurement, 3), "\n")
cat("Critical value (95% CI):", round(critical_value, 3), "\n")

Statistical Background

The Reliable Change Index is calculated as:

RCI = (xβ‚‚ - x₁) / SE_diff

where:

  • x₁ = baseline score
  • xβ‚‚ = follow-up score
  • SE_diff = √(2 Γ— SEΒ²)
  • SE = SD₁ Γ— √(1 - r₁₂)

The method accounts for:

  1. Measurement Error: Through the standard error of measurement (SE)
  2. Test-Retest Reliability: Via the correlation coefficient (r₁₂)
  3. Regression to the Mean: By using baseline SD

Function Reference

Main Functions

  • calculate_rci() - Calculate RCI with comprehensive validation
  • RCI() - Legacy function (deprecated, use calculate_rci())

Internal Helpers

  • validate_rci_inputs() - Input validation
  • calculate_test_retest_reliability() - Compute correlation
  • calculate_se_measurement() - Calculate standard error
  • calculate_se_diff() - Calculate SE of difference

Documentation

Getting Help

# Function documentation
?calculate_rci

# Package overview
?RCI

# Comprehensive tutorial (coming soon)
vignette("RCI-introduction")

Testing

The package includes comprehensive unit tests:

# Run all tests
devtools::test()

# Run with coverage report
covr::package_coverage()

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Setup

# Install development dependencies
devtools::install_dev_deps()

# Build and check package
devtools::check()

# Generate documentation
devtools::document()

Citation

If you use this package in your research, please cite:

citation("RCI")

Primary Reference:

Jacobson, N. S., & Truax, P. (1991). Clinical significance: A statistical approach to defining meaningful change in psychotherapy research. Journal of Consulting and Clinical Psychology, 59(1), 12-19. https://doi.org/10.1037/0022-006X.59.1.12

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Zetian Jia
πŸ“§ Email: [email protected]
πŸ”— GitHub: @Jiazetian

Acknowledgments

  • Inspired by the seminal work of Jacobson & Truax (1991)
  • Built with the excellent R package development ecosystem (devtools, usethis, roxygen2, testthat)
  • Special thanks to the R community for continuous support

Note: This package is under active development. Please report any issues or feature requests via GitHub Issues.

Releases

No releases published

Packages

 
 
 

Contributors

Languages