Skip to main content

SampleParaCal

PyPI version License: MIT

A comprehensive Python package for calculating sample sizes in medical diagnostic studies. This package implements a wide range of statistical methods for diagnostic research, including:

  • Sample size calculations for diagnostic accuracy studies
  • ROC curve analysis
  • Comparison of multiple diagnostic tests
  • Non-inferiority and equivalence testing
  • Multi-reader multi-case (MRMC) study design

Installation

pip install spcal

Quick Start

import spcal as spc

# Calculate sample size for a study using a two-sided confidence interval
n = spc.two_sided_CI_sample_size(var=0.25, alpha=0.05, L=0.1)
print(f"Required sample size: {n}")

# Calculate AUC variance
variance = spc.AUC_variance_binormal(A=0.85, R=1.5)
print(f"AUC variance: {variance:.6f}")

# Compare two diagnostic tests
n = spc.sample_size_for_two_diagnostic_tests(
    alpha=0.05, 
    beta=0.2, 
    delta=0.1, 
    Se1=0.85, 
    Se2=0.75, 
    coPos=0.6
)
print(f"Sample size for comparison: {n}")

Features

Single Diagnostic Method Evaluation

  • Confidence interval-based sample size calculations
  • Area Under ROC Curve (AUC) variance estimation
  • Partial AUC analysis
  • High-accuracy test evaluation
  • Clustered data analysis

Threshold Optimization

  • Sensitivity calculation at fixed false positive rates
  • Variance estimation for transformed sensitivity
  • Binormal ROC curve modeling

Diagnostic Method Comparison

  • Paired and unpaired sample size calculations
  • Relative sensitivity and specificity comparisons
  • Covariance estimation for correlated tests
  • Predictive value comparison (PPV/NPV)

Non-inferiority and Equivalence Testing

  • Non-inferiority sample size calculations
  • Equivalence testing for diagnostic methods
  • Clustered data equivalence testing

Multi-reader Studies

  • Variance components for reader variability
  • Sample size for multi-reader studies
  • Multi-reader multi-case (MRMC) study design

License

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

Demo Book Reference

Metadata

Release files for spcal 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spcal 0.1.1
File Size Uploaded
spcal-0.1.1.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spcal 0.1.1
File Interpreter ABI Platform
spcal-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.5 kB

Release files / spcal-0.1.1.tar.gz

Download URL spcal-0.1.1.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
add2b1b820988ef7af93ef7b99ee7b9fbddd393e90658dc583926b3a6bc75acb
BLAKE2b-256 checksum
How to use checksums
be14ecb54ced7121d3859ada99e98b9e2d22165a00ab639e0725e4b0e5c89d8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.16

Release files / spcal-0.1.1-py3-none-any.whl

Download URL spcal-0.1.1-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38e13a3a2207629ae1bc5347bd31af48f0e0a60ee46a8566a498b132a0ca8fe7
BLAKE2b-256 checksum
How to use checksums
1a84ddb480bdc49e8c3070200820f8ad287ad150784c5bf7ec0967281f7f8549
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.16

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page