Skip to main content

A package for sample size other parameters calculations in diagnostic tests.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spcal-0.1.1.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spcal-0.1.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file spcal-0.1.1.tar.gz.

File metadata

  • Download URL: spcal-0.1.1.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.16

File hashes

Hashes for spcal-0.1.1.tar.gz
Algorithm Hash digest
SHA256 add2b1b820988ef7af93ef7b99ee7b9fbddd393e90658dc583926b3a6bc75acb
MD5 60e95c9a513c31865b79ed3921a47c6d
BLAKE2b-256 be14ecb54ced7121d3859ada99e98b9e2d22165a00ab639e0725e4b0e5c89d8e

See more details on using hashes here.

File details

Details for the file spcal-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: spcal-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.16

File hashes

Hashes for spcal-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 38e13a3a2207629ae1bc5347bd31af48f0e0a60ee46a8566a498b132a0ca8fe7
MD5 f598732671a57d487212fb1ac03d3f35
BLAKE2b-256 1a84ddb480bdc49e8c3070200820f8ad287ad150784c5bf7ec0967281f7f8549

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page