scia

Single-Case Data Analysis in Python

PyPI GitHub Open Source

Overview

scia is a robust Python package dedicated to single-case data analysis. Designed for researchers and practitioners working with single-case experimental designs, it provides a comprehensive suite of statistical methods to analyze, interpret, and report data effectively.

Key Features

  • Comprehensive statistical methods for single-case analysis
  • Missing value handling and data preprocessing
  • Advanced treatment effect evaluation
  • Bayesian piecewise linear regression
  • Multiple non-overlap and effect size metrics

Functionality

The package includes functionality to create and preprocess single-case data frames, fill in missing values, filter data, and compute key non-overlap and effect size metrics. Advanced methods for evaluating treatment effects and trends are available through various analytical tools:

Core Analysis Functions

  • autocorr - For autocorrelation analysis
  • bayesplm - For Bayesian piecewise linear regression
  • pnd - Percentage of Non-overlapping Data
  • pem - Percentage of data points Exceeding the Median
  • pet - Percentage Exceeding the Trend
  • nap - Non-overlap of All Pairs
  • pand - Percentage of All Non-overlapping Data
  • ird - Improvement Rate Difference
  • tau_u - Tau-U analysis
  • corrected_tau - Corrected Tau metric

Documentation Status

Note: Documentation is ongoing and being updated. Please be patient as we continue to enhance the documentation.

For the most up-to-date documentation, visit: scia Documentation

Installation

Install scia using pip:

pip install scia

Usage Example

import scia
import pandas as pd

# Load or create single-case data
data = pd.DataFrame({
    'phase': ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B'],
    'score': [12, 15, 14, 13, 18, 20, 22, 25]
})

# Calculate percentage of non-overlapping data
pnd_result = scia.pnd(data, 'score', 'phase', baseline='A', treatment='B')
print(f"PND: {pnd_result}")

# Calculate Tau-U
tau_u_result = scia.tau_u(data, 'score', 'phase', baseline='A', treatment='B')
print(f"Tau-U: {tau_u_result}")

# Run Bayesian piecewise linear regression
bayes_result = scia.bayesplm(data, 'score', phase_column='phase')
print("Bayesian Analysis Results:")
print(bayes_result)