pystatsbio 4.0.0__tar.gz → 4.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/CHANGELOG.md +90 -0
  2. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/PKG-INFO +11 -3
  3. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/README.md +10 -2
  4. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/PYSTATSBIO_CONTEXT.md +5 -2
  5. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/conf.py +2 -2
  6. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pyproject.toml +1 -1
  7. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/__init__.py +1 -1
  8. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/doseresponse/_common.py +6 -0
  9. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/doseresponse/_fit.py +86 -21
  10. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/doseresponse/_potency.py +24 -17
  11. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/gee/__init__.py +33 -9
  12. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/pk/_common.py +18 -0
  13. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/pk/_nca.py +51 -7
  14. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/doseresponse/test_ryegrass_drc.py +54 -0
  15. pystatsbio-4.0.2/tests/pk/test_ars_lambda_z.py +80 -0
  16. pystatsbio-4.0.0/tests/pk/test_ars_lambda_z.py +0 -33
  17. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/.github/workflows/publish.yml +0 -0
  18. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/.github/workflows/trigger-docs-rebuild.yml +0 -0
  19. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/.gitignore +0 -0
  20. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/.release/CHECKLIST.md +0 -0
  21. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/.release/UNRELEASED.md +0 -0
  22. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/.release/release.py +0 -0
  23. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/LICENSE +0 -0
  24. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/Forge.md +0 -0
  25. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/GPU_BACKEND_NOTES.md +0 -0
  26. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/Makefile +0 -0
  27. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/PROGRESS.md +0 -0
  28. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/Powerhouse.md +0 -0
  29. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/SGC_BIO_DIRECTIVE.md +0 -0
  30. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/SGC_CORE_DIRECTIVE.md +0 -0
  31. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/.buildinfo +0 -0
  32. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/.doctrees/__intersphinx_cache__/numpy_objects.inv +0 -0
  33. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/.doctrees/__intersphinx_cache__/python_objects.inv +0 -0
  34. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/.doctrees/__intersphinx_cache__/scipy_objects.inv +0 -0
  35. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/.doctrees/diagnostic.doctree +0 -0
  36. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/.doctrees/doseresponse.doctree +0 -0
  37. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/.doctrees/environment.pickle +0 -0
  38. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/.doctrees/index.doctree +0 -0
  39. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/.doctrees/pk.doctree +0 -0
  40. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/.doctrees/power.doctree +0 -0
  41. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/index.html +0 -0
  42. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/diagnostic/_accuracy.html +0 -0
  43. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/diagnostic/_batch.html +0 -0
  44. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/diagnostic/_common.html +0 -0
  45. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/diagnostic/_cutoff.html +0 -0
  46. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/diagnostic/_roc.html +0 -0
  47. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/doseresponse/_batch.html +0 -0
  48. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/doseresponse/_bmd.html +0 -0
  49. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/doseresponse/_common.html +0 -0
  50. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/doseresponse/_fit.html +0 -0
  51. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/doseresponse/_models.html +0 -0
  52. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/doseresponse/_potency.html +0 -0
  53. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/pk/_common.html +0 -0
  54. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/pk/_nca.html +0 -0
  55. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/power/_anova.html +0 -0
  56. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/power/_cluster.html +0 -0
  57. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/power/_common.html +0 -0
  58. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/power/_crossover.html +0 -0
  59. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/power/_means.html +0 -0
  60. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/power/_noninferiority.html +0 -0
  61. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/power/_proportions.html +0 -0
  62. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_modules/pystatsbio/power/_survival.html +0 -0
  63. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_sources/diagnostic.rst.txt +0 -0
  64. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_sources/doseresponse.rst.txt +0 -0
  65. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_sources/index.rst.txt +0 -0
  66. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_sources/pk.rst.txt +0 -0
  67. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_sources/power.rst.txt +0 -0
  68. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/base-stemmer.js +0 -0
  69. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/basic.css +0 -0
  70. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/custom.css +0 -0
  71. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/debug.css +0 -0
  72. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/doctools.js +0 -0
  73. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/documentation_options.js +0 -0
  74. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/english-stemmer.js +0 -0
  75. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/file.png +0 -0
  76. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/language_data.js +0 -0
  77. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/minus.png +0 -0
  78. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/plus.png +0 -0
  79. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/pygments.css +0 -0
  80. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/scripts/furo-extensions.js +0 -0
  81. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/scripts/furo.js +0 -0
  82. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/scripts/furo.js.LICENSE.txt +0 -0
  83. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/scripts/furo.js.map +0 -0
  84. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/searchtools.js +0 -0
  85. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/skeleton.css +0 -0
  86. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/sphinx_highlight.js +0 -0
  87. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/styles/furo-extensions.css +0 -0
  88. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/styles/furo-extensions.css.map +0 -0
  89. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/styles/furo.css +0 -0
  90. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/_static/styles/furo.css.map +0 -0
  91. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/diagnostic.html +0 -0
  92. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/doseresponse.html +0 -0
  93. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/genindex.html +0 -0
  94. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/index.html +0 -0
  95. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/objects.inv +0 -0
  96. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/pk.html +0 -0
  97. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/power.html +0 -0
  98. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/py-modindex.html +0 -0
  99. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/search.html +0 -0
  100. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_build/html/searchindex.js +0 -0
  101. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/_static/custom.css +0 -0
  102. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/diagnostic.rst +0 -0
  103. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/doseresponse.rst +0 -0
  104. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/epi.rst +0 -0
  105. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/gee.rst +0 -0
  106. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/index.rst +0 -0
  107. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/meta.rst +0 -0
  108. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/pk.rst +0 -0
  109. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/docs/power.rst +0 -0
  110. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/CONVENTIONS.md +0 -0
  111. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/diagnostic/__init__.py +0 -0
  112. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/diagnostic/_accuracy.py +0 -0
  113. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/diagnostic/_batch.py +0 -0
  114. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/diagnostic/_common.py +0 -0
  115. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/diagnostic/_cutoff.py +0 -0
  116. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/diagnostic/_roc.py +0 -0
  117. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/doseresponse/__init__.py +0 -0
  118. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/doseresponse/_batch.py +0 -0
  119. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/doseresponse/_bmd.py +0 -0
  120. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/doseresponse/_models.py +0 -0
  121. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/epi/__init__.py +0 -0
  122. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/epi/_common.py +0 -0
  123. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/epi/_mantel_haenszel.py +0 -0
  124. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/epi/_measures.py +0 -0
  125. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/epi/_standardize.py +0 -0
  126. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/gee/_common.py +0 -0
  127. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/gee/_correlation.py +0 -0
  128. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/gee/_estimating_equations.py +0 -0
  129. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/gee/_sandwich.py +0 -0
  130. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/gee/backends/__init__.py +0 -0
  131. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/gee/backends/_gpu_correlation.py +0 -0
  132. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/gee/backends/_gpu_family.py +0 -0
  133. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/gee/backends/gpu_fit.py +0 -0
  134. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/meta/__init__.py +0 -0
  135. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/meta/_common.py +0 -0
  136. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/meta/_fixed.py +0 -0
  137. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/meta/_heterogeneity.py +0 -0
  138. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/meta/_random.py +0 -0
  139. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/pk/__init__.py +0 -0
  140. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/power/__init__.py +0 -0
  141. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/power/_anova.py +0 -0
  142. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/power/_cluster.py +0 -0
  143. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/power/_common.py +0 -0
  144. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/power/_crossover.py +0 -0
  145. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/power/_means.py +0 -0
  146. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/power/_noninferiority.py +0 -0
  147. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/power/_proportions.py +0 -0
  148. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/power/_survival.py +0 -0
  149. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/pystatsbio/py.typed +0 -0
  150. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/__init__.py +0 -0
  151. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/diagnostic/__init__.py +0 -0
  152. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/diagnostic/test_accuracy.py +0 -0
  153. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/diagnostic/test_batch.py +0 -0
  154. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/diagnostic/test_common.py +0 -0
  155. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/diagnostic/test_cutoff.py +0 -0
  156. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/diagnostic/test_roc.py +0 -0
  157. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/diagnostic/test_roc_test.py +0 -0
  158. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/doseresponse/__init__.py +0 -0
  159. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/doseresponse/test_batch.py +0 -0
  160. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/doseresponse/test_bmd.py +0 -0
  161. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/doseresponse/test_common.py +0 -0
  162. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/doseresponse/test_fit.py +0 -0
  163. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/doseresponse/test_models.py +0 -0
  164. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/doseresponse/test_potency.py +0 -0
  165. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/epi/__init__.py +0 -0
  166. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/epi/test_epi.py +0 -0
  167. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/gee/__init__.py +0 -0
  168. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/gee/test_gee.py +0 -0
  169. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/meta/__init__.py +0 -0
  170. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/meta/test_meta.py +0 -0
  171. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/meta/test_metafor_bcg.py +0 -0
  172. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/pk/__init__.py +0 -0
  173. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/pk/test_common.py +0 -0
  174. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/pk/test_nca.py +0 -0
  175. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/power/__init__.py +0 -0
  176. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/power/test_anova.py +0 -0
  177. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/power/test_cluster.py +0 -0
  178. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/power/test_common.py +0 -0
  179. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/power/test_crossover.py +0 -0
  180. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/power/test_means.py +0 -0
  181. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/power/test_noninferiority.py +0 -0
  182. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/power/test_proportions.py +0 -0
  183. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/tests/power/test_survival.py +0 -0
  184. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/validation/README.md +0 -0
  185. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/validation/pyproject.toml +0 -0
  186. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/validation/pystatsbioval/__init__.py +0 -0
  187. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/validation/pystatsbioval/device.py +0 -0
  188. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/validation/pystatsbioval/estimates.py +0 -0
  189. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/validation/pystatsbioval/measure.py +0 -0
  190. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/validation/pystatsbioval/record.py +0 -0
  191. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/validation/pystatsbioval/rrunner.py +0 -0
  192. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/validation/pystatsbioval/serialize.py +0 -0
  193. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/validation/pystatsbioval/timing.py +0 -0
  194. {pystatsbio-4.0.0 → pystatsbio-4.0.2}/validation/tests/test_harness.py +0 -0
@@ -1,5 +1,95 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.2
4
+
5
+ ### Summary
6
+
7
+ 4.0.2 fixes defects surfaced while assembling the formal validation evidence for
8
+ 4.0.1 — most importantly a silently-wrong relative potency for non-parallel
9
+ asymmetric dose-response curves, and a silent failure in NCA. It also aligns the
10
+ dose-response standard errors with R drc and implements the AUMC/MRT parameters
11
+ the docstring already advertised.
12
+
13
+ ### Added
14
+
15
+ - **`pk.nca()` now computes and exposes AUMC and MRT.** `.aumc_last` (area under
16
+ the first moment curve to the last measurable concentration), `.aumc_inf`
17
+ (extrapolated to infinity), and `.mrt` (mean residence time = AUMC_inf/AUC_inf)
18
+ are new `NCASolution` accessors — standard NCA parameters that the module
19
+ docstring listed but had never actually wired into the result. They match
20
+ `NonCompart::sNCA`'s AUMCLST/AUMCIFO/MRTEVIFO to ~1e-13.
21
+ (`pystatsbio/pk/_nca.py`, `pystatsbio/pk/_common.py`)
22
+ - **`DoseResponseSolution` exposes the parameter covariance matrix** as `.cov`.
23
+
24
+ ### Changed
25
+
26
+ - **Dose-response standard errors now use the observed-information covariance,
27
+ matching R drc.** `fit_drm` coefficient SEs, the `ec50()` delta-method SE, and
28
+ the `relative_potency()` Fieller interval previously used the Gauss-Newton
29
+ covariance `s²(JᵀJ)⁻¹`; they now use `s²(½H)⁻¹` (the inverse scaled RSS
30
+ Hessian), which is exactly what `drc::drm()`/`drc::ED()` report. The two are
31
+ asymptotically equivalent but differed by up to ~11% on the Hill-slope SE for
32
+ the log-logistic family (and ~1% on the EC50 CI width); coefficient SEs now
33
+ agree with drc's `summary()` to <1% and the EC50 SE to <4e-4. This is a small
34
+ user-visible change to the reported uncertainties (the point estimates are
35
+ unchanged). (`pystatsbio/doseresponse/_fit.py`, `_potency.py`)
36
+
37
+ ### Fixed
38
+
39
+ - **`doseresponse.relative_potency()` now ratios the solved ED50s, not the raw `e`
40
+ parameters.** It previously divided the two fits' `e` location parameters. For
41
+ the symmetric LL.4 — and for any two *parallel* curves, where the `e`-to-ED50
42
+ factor is identical and cancels — that is the same number. For **non-parallel
43
+ asymmetric** fits (LL.5/W1.4/W2.4/BC.5) it is not the potency ratio at all: on a
44
+ non-parallel LL.5 pair it returned 1.70 where the true ED50 ratio is 0.40 — the
45
+ wrong magnitude *and* the wrong direction. It now uses the same solved ED50 (and
46
+ its delta-method SE) that `ec50()` returns, so it is correct regardless of
47
+ parallelism. Parallel-curve results are unchanged.
48
+ (`pystatsbio/doseresponse/_potency.py`)
49
+ - **`pk.nca()` no longer fails silently when the terminal phase cannot be fitted.**
50
+ The `LambdaZEstimationError` was suppressed, returning `lambda_z` — and every
51
+ parameter derived from it (`half_life`, `auc_inf`, `auc_pct_extrap`, `clearance`,
52
+ `vz`) — as `None` with an **empty** `.warnings` tuple and no other signal. The
53
+ reason is now reported in `.warnings`. The degenerate all-zero-concentration
54
+ profile warns too. (`pystatsbio/pk/_nca.py`)
55
+
56
+ ### Documentation
57
+
58
+ - `pk`: the module docstring claimed **AUMC and MRT** among the computed
59
+ parameters; neither is computed or exposed by `nca()` (the moment-curve helpers
60
+ are not wired into the result). The claim is removed and the omission stated.
61
+ - `pk`: "Validates against PKNCA" removed — PKNCA uses a different default
62
+ terminal-slope selection and is not a validated reference for this module. The
63
+ validated reference is `NonCompart::sNCA()`.
64
+ - README: `relative_potency()` was listed as `drc::EDcomp()` **"with parallelism
65
+ test"** — no parallelism test is performed. The entry now states what the
66
+ function actually does (ratio of ED50s with a Fieller interval), and the
67
+ docstring notes that assessing parallelism is the caller's responsibility.
68
+
69
+
70
+ ## 4.0.1
71
+
72
+ ### Summary
73
+
74
+ 4.0.1 corrects the documented reference for the `gee` working-correlation
75
+ estimator. No numeric behaviour changes.
76
+
77
+ ### Documentation
78
+
79
+ - **`gee` now states its correlation estimator and cites the right reference.**
80
+ The working-correlation parameters use the classical **Liang-Zeger (1986)**
81
+ method of moments — for AR(1), the lag-1 adjacent-pair Pearson-residual moment,
82
+ the same convention as R `gee::gee(corstr="AR-M", Mv=1)` and **SAS PROC
83
+ GENMOD**. The docs previously cited only `geepack::geeglm()`, which uses the
84
+ Yan & Fine (2004) *all-lag* estimating equation for the AR(1) correlation and so
85
+ is **not** the matching reference for that structure. Both estimators are
86
+ consistent when AR(1) is correctly specified (both recover the true alpha), but
87
+ they converge to different limits when AR(1) is misspecified — pystatsbio/SAS to
88
+ the true lag-1 correlation, geepack to an all-lag compromise. Coefficients and
89
+ robust SE still match `geepack` under independence and exchangeable.
90
+ (`pystatsbio/gee/__init__.py`, `README.md`)
91
+
92
+
3
93
  ## 4.0.0
4
94
 
5
95
  ### Summary
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pystatsbio
3
- Version: 4.0.0
3
+ Version: 4.0.2
4
4
  Summary: Biotech and pharmaceutical statistical computing for Python
5
5
  Project-URL: Homepage, https://sgcx.org/technology/pystatsbio/
6
6
  Project-URL: Documentation, https://sgcx.org/docs/pystatsbio/
@@ -342,7 +342,7 @@ print(result.summary())
342
342
  | `fit_drm()` | `drc::drm()` |
343
343
  | `fit_drm_batch()` | vectorized `drc::drm()` |
344
344
  | `ec50()` | `drc::ED()` |
345
- | `relative_potency()` | `drc::EDcomp()` with parallelism test |
345
+ | `relative_potency()` | `drc::EDcomp()` (ratio of ED50s, Fieller CI) |
346
346
  | `bmd()` | `drc::bmd()` / `BMDS` |
347
347
 
348
348
  Models: `LL.4` (4PL), `LL.5` (5PL), `W1.4` (Weibull-1), `W2.4` (Weibull-2),
@@ -388,7 +388,15 @@ Routes: `iv` (intravenous), `ev` (extravascular).
388
388
 
389
389
  | Function | R equivalent |
390
390
  |----------|--------------|
391
- | `gee()` | `geepack::geeglm()` |
391
+ | `gee()` | `gee::gee()` / SAS `PROC GENMOD` (Liang-Zeger); `geepack::geeglm()` |
392
+
393
+ The working-correlation parameters use the classical **Liang-Zeger (1986)**
394
+ method-of-moments estimator — for AR(1), the lag-1 adjacent-pair moment, the same
395
+ convention as `gee::gee(corstr="AR-M", Mv=1)` and **SAS PROC GENMOD**.
396
+ `geepack::geeglm` instead uses the Yan & Fine (2004) all-lag estimating equation;
397
+ both are consistent when AR(1) is correctly specified, but they differ when it is
398
+ not. Coefficients and robust SE match `geepack` under independence and
399
+ exchangeable.
392
400
 
393
401
  Families: `gaussian`, `binomial`, `poisson`.
394
402
  Correlation structures: `independence`, `exchangeable`, `ar1`, `unstructured`.
@@ -295,7 +295,7 @@ print(result.summary())
295
295
  | `fit_drm()` | `drc::drm()` |
296
296
  | `fit_drm_batch()` | vectorized `drc::drm()` |
297
297
  | `ec50()` | `drc::ED()` |
298
- | `relative_potency()` | `drc::EDcomp()` with parallelism test |
298
+ | `relative_potency()` | `drc::EDcomp()` (ratio of ED50s, Fieller CI) |
299
299
  | `bmd()` | `drc::bmd()` / `BMDS` |
300
300
 
301
301
  Models: `LL.4` (4PL), `LL.5` (5PL), `W1.4` (Weibull-1), `W2.4` (Weibull-2),
@@ -341,7 +341,15 @@ Routes: `iv` (intravenous), `ev` (extravascular).
341
341
 
342
342
  | Function | R equivalent |
343
343
  |----------|--------------|
344
- | `gee()` | `geepack::geeglm()` |
344
+ | `gee()` | `gee::gee()` / SAS `PROC GENMOD` (Liang-Zeger); `geepack::geeglm()` |
345
+
346
+ The working-correlation parameters use the classical **Liang-Zeger (1986)**
347
+ method-of-moments estimator — for AR(1), the lag-1 adjacent-pair moment, the same
348
+ convention as `gee::gee(corstr="AR-M", Mv=1)` and **SAS PROC GENMOD**.
349
+ `geepack::geeglm` instead uses the Yan & Fine (2004) all-lag estimating equation;
350
+ both are consistent when AR(1) is correctly specified, but they differ when it is
351
+ not. Coefficients and robust SE match `geepack` under independence and
352
+ exchangeable.
345
353
 
346
354
  Families: `gaussian`, `binomial`, `poisson`.
347
355
  Correlation structures: `independence`, `exchangeable`, `ar1`, `unstructured`.
@@ -213,8 +213,8 @@ NCA is required for every PK study. Self-contained, well-defined, formulaic calc
213
213
  - **Half-life**: terminal elimination rate constant via log-linear regression
214
214
  - **Clearance**: CL = Dose / AUC
215
215
  - **Volume of distribution**: Vz = Dose / (lambda_z * AUC)
216
- - **PK summary statistics**: geometric means and CVs (standard for PK data), confidence intervals on log-scale parameters
217
- - **Bioequivalence PK**: Cmax and AUC ratio analysis
216
+ - **AUMC / MRT**: area under the first moment curve (last + extrapolated) and mean
217
+ residence time (`.aumc_last`, `.aumc_inf`, `.mrt`)
218
218
 
219
219
  **R packages to match:** `PKNCA`, `NonCompart`
220
220
 
@@ -226,6 +226,9 @@ from pystatsbio import pk
226
226
  # NCA (CPU - always small data)
227
227
  result = pk.nca(time, concentration, dose=100, route='ev')
228
228
  print(result.auc_inf, result.cmax, result.half_life, result.clearance)
229
+ print(result.aumc_inf, result.mrt) # first-moment area and mean residence time
230
+ # If the terminal phase can't be fitted, lambda_z (and everything derived from it)
231
+ # is None and result.warnings says why.
229
232
  ```
230
233
 
231
234
  ---
@@ -4,8 +4,8 @@
4
4
  project = 'PyStatsBio'
5
5
  copyright = '2026, SGCX'
6
6
  author = 'Hai-Shuo'
7
- version = '4.0.0'
8
- release = '4.0.0'
7
+ version = '4.0.2'
8
+ release = '4.0.2'
9
9
 
10
10
  # -- General configuration ---------------------------------------------------
11
11
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pystatsbio"
7
- version = "4.0.0"
7
+ version = "4.0.2"
8
8
  description = "Biotech and pharmaceutical statistical computing for Python"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -9,7 +9,7 @@ Usage:
9
9
  from pystatsbio import power, doseresponse, diagnostic, pk
10
10
  """
11
11
 
12
- __version__ = "4.0.0"
12
+ __version__ = "4.0.2"
13
13
  __author__ = "Hai-Shuo"
14
14
  __email__ = "contact@sgcx.org"
15
15
 
@@ -79,6 +79,7 @@ class DoseResponseParams:
79
79
 
80
80
  curve: CurveParams
81
81
  se: NDArray[np.floating] # standard errors of parameters
82
+ cov: NDArray[np.floating] # parameter covariance (n_params, n_params)
82
83
  residuals: NDArray[np.floating]
83
84
  rss: float
84
85
  aic: float
@@ -133,6 +134,11 @@ class DoseResponseSolution(SolutionReprMixin):
133
134
  def se(self) -> NDArray[np.floating]:
134
135
  return self._result.params.se
135
136
 
137
+ @property
138
+ def cov(self) -> NDArray[np.floating]:
139
+ """Parameter covariance matrix (observed information, matching drc)."""
140
+ return self._result.params.cov
141
+
136
142
  @property
137
143
  def residuals(self) -> NDArray[np.floating]:
138
144
  return self._result.params.residuals
@@ -11,6 +11,8 @@ Validates against: R drc::drm()
11
11
 
12
12
  from __future__ import annotations
13
13
 
14
+ from collections.abc import Callable
15
+
14
16
  import numpy as np
15
17
  from numpy.typing import NDArray
16
18
  from pystatistics.core.exceptions import ValidationError
@@ -155,36 +157,79 @@ def _initial_params(
155
157
  # Standard error computation
156
158
  # ---------------------------------------------------------------------------
157
159
 
158
- def _compute_se(
160
+ def _rss_hessian(
161
+ rss_fn: Callable[[NDArray], float],
162
+ popt: NDArray,
163
+ rel_step: float = 1e-4,
164
+ ) -> NDArray[np.floating]:
165
+ """Numerical Hessian of the RSS objective at ``popt`` (central differences).
166
+
167
+ Second-derivative central differences have error O(h^2) + O(eps_machine/h^2),
168
+ so the step is taken relative to each parameter's own scale.
169
+ """
170
+ p = len(popt)
171
+ h = rel_step * np.maximum(np.abs(popt), 1.0)
172
+ H = np.empty((p, p), dtype=np.float64)
173
+ for j in range(p):
174
+ for k in range(j, p):
175
+ ej = np.zeros(p); ej[j] = h[j]
176
+ ek = np.zeros(p); ek[k] = h[k]
177
+ val = (
178
+ rss_fn(popt + ej + ek)
179
+ - rss_fn(popt + ej - ek)
180
+ - rss_fn(popt - ej + ek)
181
+ + rss_fn(popt - ej - ek)
182
+ ) / (4.0 * h[j] * h[k])
183
+ H[j, k] = H[k, j] = val
184
+ return H
185
+
186
+
187
+ def _compute_cov_se(
188
+ rss_fn: Callable[[NDArray], float],
189
+ popt: NDArray,
159
190
  jac: NDArray,
160
191
  rss: float,
161
192
  n_obs: int,
162
193
  n_params: int,
163
- ) -> NDArray[np.floating]:
164
- """Standard errors from Jacobian: ``se = sqrt(diag((J'J)^{-1} * s²))``.
165
-
166
- Parameters
167
- ----------
168
- jac : (n_obs, n_params)
169
- Jacobian of the residual vector at the solution.
170
- rss : float
171
- Residual sum of squares.
172
- n_obs, n_params : int
173
- Number of observations and parameters.
194
+ ) -> tuple[NDArray[np.floating], NDArray[np.floating]]:
195
+ """Parameter covariance and standard errors from the OBSERVED information.
196
+
197
+ The covariance is ``cov = s2 * (H/2)^-1 = 2*s2*H^-1`` where ``H`` is the
198
+ Hessian of the residual sum of squares and ``s2 = RSS/(n-p)``. Equivalently
199
+ ``(J'J + sum_i r_i * d2r_i)^-1 * s2`` — i.e. Gauss-Newton PLUS the
200
+ second-order curvature term.
201
+
202
+ This is what R ``drc::drm()`` reports (its ``vcCont`` inverts the scaled RSS
203
+ Hessian), and it is the reference this module validates against. The
204
+ Gauss-Newton approximation ``s2*(J'J)^-1`` drops the curvature term; both are
205
+ asymptotically valid, but on a curved model they differ materially along
206
+ poorly-conditioned directions (up to ~11% on the Hill slope for the log-logistic
207
+ family), so we match the reference rather than the cheaper approximation.
208
+
209
+ Falls back to Gauss-Newton if the Hessian is singular or not usable.
174
210
  """
175
211
  if n_obs <= n_params:
176
- return np.full(n_params, np.nan)
212
+ nan = np.full(n_params, np.nan)
213
+ return np.full((n_params, n_params), np.nan), nan
177
214
 
178
215
  s2 = rss / (n_obs - n_params)
179
- JtJ = jac.T @ jac
180
216
 
181
217
  try:
182
- cov = np.linalg.inv(JtJ) * s2
183
- se = np.sqrt(np.maximum(np.diag(cov), 0.0))
184
- except np.linalg.LinAlgError:
185
- se = np.full(n_params, np.nan)
186
-
187
- return se
218
+ H = _rss_hessian(rss_fn, popt)
219
+ cov = 2.0 * s2 * np.linalg.inv(H)
220
+ diag = np.diag(cov)
221
+ if not np.all(np.isfinite(diag)) or np.any(diag < 0):
222
+ raise np.linalg.LinAlgError("non-positive observed-information variance")
223
+ except (np.linalg.LinAlgError, ValueError, FloatingPointError):
224
+ # Fall back to the Gauss-Newton covariance.
225
+ try:
226
+ cov = np.linalg.inv(jac.T @ jac) * s2
227
+ except np.linalg.LinAlgError:
228
+ nan = np.full(n_params, np.nan)
229
+ return np.full((n_params, n_params), np.nan), nan
230
+
231
+ se = np.sqrt(np.maximum(np.diag(cov), 0.0))
232
+ return cov, se
188
233
 
189
234
 
190
235
  # ---------------------------------------------------------------------------
@@ -226,6 +271,16 @@ def fit_drm(
226
271
  -------
227
272
  DoseResponseSolution
228
273
 
274
+ Notes
275
+ -----
276
+ Parameter standard errors (``.se``) and the covariance (``.cov``) use the
277
+ **observed-information** covariance ``s²·(½H)⁻¹`` — the inverse of the scaled
278
+ Hessian of the residual sum of squares, ``s² = RSS/(n-p)`` — which is what R
279
+ ``drc::drm()`` reports. This differs from the Gauss-Newton approximation
280
+ ``s²·(JᵀJ)⁻¹`` used by ``scipy.optimize.curve_fit`` / R ``nls`` by the
281
+ second-order curvature term; the two are asymptotically equivalent but can
282
+ differ by ~10% on a poorly-conditioned coefficient (e.g. the Hill slope).
283
+
229
284
  Examples
230
285
  --------
231
286
  >>> import numpy as np
@@ -372,7 +427,16 @@ def fit_drm(
372
427
  n_iter = result.nfev
373
428
 
374
429
  jac = result.jac
375
- se = _compute_se(jac, rss, n_obs, n_params)
430
+
431
+ def _rss_of(theta: NDArray) -> float:
432
+ """RSS at an arbitrary parameter vector (same objective the fit minimised)."""
433
+ kwargs = dict(zip(param_names, theta, strict=True))
434
+ r = response - model_func(dose, **kwargs)
435
+ if weights is not None:
436
+ r = r * np.sqrt(weights)
437
+ return float(np.sum(r**2))
438
+
439
+ cov, se = _compute_cov_se(_rss_of, popt, jac, rss, n_obs, n_params)
376
440
 
377
441
  # AIC / BIC
378
442
  aic = float(n_obs * np.log(rss / n_obs) + 2 * n_params)
@@ -383,6 +447,7 @@ def fit_drm(
383
447
  params = DoseResponseParams(
384
448
  curve=curve_params,
385
449
  se=se,
450
+ cov=cov,
386
451
  residuals=res_vec,
387
452
  rss=rss,
388
453
  aic=aic,
@@ -27,7 +27,6 @@ from scipy.stats import norm
27
27
  from scipy.stats import t as t_dist
28
28
 
29
29
  from pystatsbio.doseresponse._common import CurveParams, DoseResponseSolution
30
- from pystatsbio.doseresponse._models import _MODEL_MAP
31
30
 
32
31
 
33
32
  @dataclass(frozen=True)
@@ -211,9 +210,9 @@ def _solve_ed50(curve: CurveParams, e_hint: float) -> float:
211
210
  def _ed50_delta_se(fit_result: DoseResponseSolution, ed50: float) -> float:
212
211
  """Delta-method SE of the solved ED50, matching drc::ED(interval="delta").
213
212
 
214
- Uses the full parameter covariance reconstructed from the fit Jacobian,
215
- ``cov = (rss/(n-p)) · (JᵀJ)⁻¹``, and the gradient of ED50 with respect to
216
- the parameters (finite differences, re-solving ED50 at each perturbation).
213
+ Uses the fit's parameter covariance (observed information, the same matrix
214
+ drc uses) and the gradient of ED50 with respect to the parameters (finite
215
+ differences, re-solving ED50 at each perturbation).
217
216
  """
218
217
  model = fit_result.model
219
218
  theta = fit_result.params.to_array()
@@ -222,11 +221,8 @@ def _ed50_delta_se(fit_result: DoseResponseSolution, ed50: float) -> float:
222
221
  if n_obs <= n_p or not (np.isfinite(ed50) and ed50 > 0):
223
222
  return float("nan")
224
223
 
225
- jac = fit_result.jac
226
- s2 = fit_result.rss / (n_obs - n_p)
227
- try:
228
- cov = np.linalg.inv(jac.T @ jac) * s2
229
- except np.linalg.LinAlgError:
224
+ cov = fit_result.cov
225
+ if cov is None or not np.all(np.isfinite(cov)):
230
226
  return float("nan")
231
227
 
232
228
  grad = np.zeros(n_p)
@@ -321,11 +317,22 @@ def relative_potency(
321
317
  *,
322
318
  conf_level: float = 0.95,
323
319
  ) -> RelativePotencySolution:
324
- """Relative potency: ratio of EC50s between two curves with Fieller's CI.
320
+ """Relative potency: ratio of EC50s (ED50s) between two curves, Fieller's CI.
325
321
 
326
- Computes ``rho = EC50_2 / EC50_1`` with a confidence interval based on
322
+ Computes ``rho = ED50_2 / ED50_1`` with a confidence interval based on
327
323
  Fieller's theorem for the ratio of two independent estimates.
328
324
 
325
+ Both ED50s are obtained by solving each fitted curve for its half-maximal
326
+ response (the same quantity :func:`ec50` returns), *not* by ratioing the raw
327
+ ``e`` location parameters. For the symmetric LL.4 — and for any two *parallel*
328
+ curves, where the ``e``-to-ED50 factor is identical and cancels — the two are
329
+ the same. They differ for non-parallel asymmetric fits (LL.5/W1.4/W2.4/BC.5),
330
+ where ratioing ``e`` would not be the potency ratio at all.
331
+
332
+ Note this function does **not** test parallelism; relative potency is only
333
+ meaningful for curves of the same shape, and assessing that is the caller's
334
+ responsibility.
335
+
329
336
  Parameters
330
337
  ----------
331
338
  fit1 : DoseResponseSolution
@@ -344,12 +351,12 @@ def relative_potency(
344
351
  if not (0.0 < conf_level < 1.0):
345
352
  raise ValidationError(f"conf_level must be in (0, 1), got {conf_level}")
346
353
 
347
- _, names1 = _MODEL_MAP[fit1.model]
348
- _, names2 = _MODEL_MAP[fit2.model]
349
- e1 = fit1.params.ec50
350
- e2 = fit2.params.ec50
351
- se1 = float(fit1.se[names1.index("ec50")])
352
- se2 = float(fit2.se[names2.index("ec50")])
354
+ # Solved ED50s (half-maximal doses), consistent with ec50(), plus their
355
+ # delta-method SEs — NOT the raw `e` parameters.
356
+ e1 = _solve_ed50(fit1.params, fit1.params.ec50)
357
+ e2 = _solve_ed50(fit2.params, fit2.params.ec50)
358
+ se1 = _ed50_delta_se(fit1, e1)
359
+ se2 = _ed50_delta_se(fit2, e2)
353
360
 
354
361
  ratio = e2 / e1 if e1 != 0 else float("nan")
355
362
 
@@ -16,17 +16,41 @@ Supports four GLM families via pystatistics:
16
16
  - Poisson (log link)
17
17
  - Gamma (inverse link)
18
18
 
19
+ Correlation-parameter estimator (important — the two R GEE packages differ):
20
+ The working-correlation parameters are estimated by the classical **Liang-Zeger
21
+ (1986) method-of-moments** estimator. For AR(1) this means alpha is the lag-1
22
+ (adjacent-pair) Pearson-residual moment — the same convention as R
23
+ ``gee::gee(corstr="AR-M", Mv=1)`` and **SAS PROC GENMOD**.
24
+
25
+ R ``geepack::geeglm`` (geese) instead uses the Yan & Fine (2004) approach, which
26
+ solves a *second estimating equation* fitting the full ``alpha^|i-j|`` Toeplitz
27
+ structure across **all** lag pairs. Both estimators are consistent when AR(1) is
28
+ correctly specified (they recover the same true alpha), but they converge to
29
+ *different* limits when AR(1) is misspecified — pystatsbio/SAS to the true lag-1
30
+ correlation, geepack to an all-lag compromise. So pystatsbio's AR(1) alpha (and
31
+ the beta/robust SE it induces) matches ``gee::gee``/SAS, and will differ from
32
+ ``geepack::geeglm`` on data whose correlation is not truly geometric.
33
+ Independence and exchangeable agree with geepack to ~1e-5 on beta and robust SE.
34
+
19
35
  Moment-estimator convention: the dispersion (``.scale``) and the working-
20
- correlation parameter (``.alpha``) use a degrees-of-freedom correction —
36
+ correlation parameter use a degrees-of-freedom correction —
21
37
  ``sum(pearson^2)/(N - p)`` for the scale and an ``(Nstar - p)`` denominator for
22
- the correlation — matching statsmodels GEE. R ``geepack::geeglm`` (geese) uses
23
- ``N`` and ``Nstar`` with no ``-p`` correction, so ``.scale``/``.alpha`` differ
24
- from geepack by roughly ``N/(N-p)`` (typically <1-2%). This does **not** reach
25
- the inferential outputs: the coefficients and the robust (sandwich) standard
26
- errors agree with geepack to ~1e-5, because the dispersion cancels in both the
27
- coefficient update and the sandwich covariance.
28
-
29
- Validates against: R geepack::geeglm() (coefficients and robust SE)
38
+ the correlation — matching statsmodels GEE. ``geepack`` uses ``N`` and ``Nstar``
39
+ with no ``-p`` correction, so these differ by roughly ``N/(N-p)`` (typically
40
+ <1-2%). This does **not** reach the inferential outputs: the dispersion cancels
41
+ in both the coefficient update and the sandwich covariance.
42
+
43
+ Validates against: R ``gee::gee()`` / SAS PROC GENMOD (Liang-Zeger correlation
44
+ estimator, all structures); R ``geepack::geeglm()`` for coefficients and robust
45
+ SE under independence and exchangeable.
46
+
47
+ References
48
+ ----------
49
+ Liang, K.-Y. & Zeger, S. L. (1986). Longitudinal data analysis using generalized
50
+ linear models. *Biometrika*, 73(1), 13-22.
51
+
52
+ Yan, J. & Fine, J. (2004). Estimating equations for association structures.
53
+ *Statistics in Medicine*, 23(6), 859-874.
30
54
  """
31
55
 
32
56
  from __future__ import annotations
@@ -31,6 +31,9 @@ class NCAParams:
31
31
  # Derived parameters (require dose)
32
32
  clearance: float | None # CL = Dose / AUC_inf (or CL/F for oral)
33
33
  vz: float | None # Vz = Dose / (lambda_z * AUC_inf)
34
+ aumc_last: float # AUMC (first moment) from 0 to last measurable concentration
35
+ aumc_inf: float | None # AUMC extrapolated to infinity
36
+ mrt: float | None # mean residence time = AUMC_inf / AUC_inf
34
37
 
35
38
  # Metadata
36
39
  dose: float | None
@@ -109,6 +112,21 @@ class NCASolution(SolutionReprMixin):
109
112
  def vz(self) -> float | None:
110
113
  return self._result.params.vz
111
114
 
115
+ @property
116
+ def aumc_last(self) -> float:
117
+ """Area under the first moment curve to the last measurable concentration."""
118
+ return self._result.params.aumc_last
119
+
120
+ @property
121
+ def aumc_inf(self) -> float | None:
122
+ """AUMC extrapolated to infinity (None if lambda_z is not estimable)."""
123
+ return self._result.params.aumc_inf
124
+
125
+ @property
126
+ def mrt(self) -> float | None:
127
+ """Mean residence time = AUMC_inf / AUC_inf (None if lambda_z unavailable)."""
128
+ return self._result.params.mrt
129
+
112
130
  @property
113
131
  def dose(self) -> float | None:
114
132
  return self._result.params.dose