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
β
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
# 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")install.packages("RCI")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! β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).
# 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 onlybaseline <- 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")The Reliable Change Index is calculated as:
RCI = (xβ - xβ) / SE_diff
where:
xβ= baseline scorexβ= follow-up scoreSE_diff = β(2 Γ SEΒ²)SE = SDβ Γ β(1 - rββ)
The method accounts for:
- Measurement Error: Through the standard error of measurement (SE)
- Test-Retest Reliability: Via the correlation coefficient (rββ)
- Regression to the Mean: By using baseline SD
calculate_rci()- Calculate RCI with comprehensive validationRCI()- Legacy function (deprecated, usecalculate_rci())
validate_rci_inputs()- Input validationcalculate_test_retest_reliability()- Compute correlationcalculate_se_measurement()- Calculate standard errorcalculate_se_diff()- Calculate SE of difference
# Function documentation
?calculate_rci
# Package overview
?RCI
# Comprehensive tutorial (coming soon)
vignette("RCI-introduction")The package includes comprehensive unit tests:
# Run all tests
devtools::test()
# Run with coverage report
covr::package_coverage()Contributions are welcome! Please feel free to submit a Pull Request. For major changes:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
# Install development dependencies
devtools::install_dev_deps()
# Build and check package
devtools::check()
# Generate documentation
devtools::document()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
This project is licensed under the MIT License - see the LICENSE file for details.
Zetian Jia
π§ Email: [email protected]
π GitHub: @Jiazetian
- 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.