Skip to main content

smsnpycut

A small Python port of the R package smsncut: decision-theoretic optimal cutoff selection for a continuous diagnostic biomarker, modeled with scale mixtures of skew-normal (SMSN) distributions (Skew-Normal and Skew-t).

Given measurements from a healthy and a diseased group, it fits SMSN models by MLE and finds the cutoff that minimizes a weighted misclassification risk (accounting for disease prevalence and asymmetric false-positive/false-negative costs) — rather than just the symmetric Youden index. It also gives asymptotic confidence intervals for the cutoff, ROC/AUC, and Monte Carlo validation.

Install

uv sync

Quick start

import numpy as np
import smsnpycut as sc

rng = np.random.default_rng(0)
healthy = sc.SkewNormal(xi=0.0, omega=1.0, alpha=2.0)
diseased = sc.SkewNormal(xi=2.5, omega=1.2, alpha=-1.0)

fit0 = sc.fit(healthy.rvs(300, random_state=rng), family="SN")
fit1 = sc.fit(diseased.rvs(300, random_state=rng), family="SN")

# 70% prevalence of healthy, false negatives 3x costlier than false positives
c_opt = sc.optimal_cutoff(fit0.dist, fit1.dist, pi0=0.7, pi1=0.3, lam0=1.0, lam1=3.0)
ci = sc.confidence_interval(c_opt, sc.variance(c_opt, fit0, fit1, 0.7, 0.3, 1.0, 3.0))
print(c_opt, ci, sc.auc(fit0.dist, fit1.dist))

See main.py for a full worked example.

API

Module Purpose
distributions SkewNormal, SkewT — pdf/cdf/rvs
fit fit(x, family) — MLE via BFGS + Hessian
cutoff optimal_cutoff, youden_cutoff, admissible_interval, boundary_ok
inference variance, confidence_interval, identifiability
roc roc_curve, auc
simulate mc_validate — Monte Carlo check of the cutoff/CI recipe

Citation

See CITATION.bib for the original R package and its companion paper (de Paula, Mouriño & Dias Domingues, 2026).

Download files

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

Source Distribution

smsnpycut-0.1.0.tar.gz (41.1 kB view details)

Uploaded Source

Built Distribution

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

smsnpycut-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file smsnpycut-0.1.0.tar.gz.

File metadata

  • Download URL: smsnpycut-0.1.0.tar.gz
  • Upload date:
  • Size: 41.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for smsnpycut-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b5f28305b0f3fce1fb874f79971985cf8d407b9d29f9d2e05d5681521474625
MD5 f28c5109779512e462cb392847264b03
BLAKE2b-256 005c4dbd8b0147da7535eac30294e8890e36088aac25a32044a8ceb8ed08005d

See more details on using hashes here.

File details

Details for the file smsnpycut-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: smsnpycut-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for smsnpycut-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 270f52a93b85ea392d07b827a92173fb75b939cd81f05cb052d350c6533d6e1a
MD5 8509401f8efd8a3294fb163065c8132e
BLAKE2b-256 194bf896708e5a0083d3c9659142c72808f5610f1ed44463e2008a5485f9130f

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