{"id":19678876,"url":"https://github.com/adamrossnelson/conmtrx","last_synced_at":"2026-03-04T15:01:45.802Z","repository":{"id":178200179,"uuid":"105583570","full_name":"adamrossnelson/conmtrx","owner":"adamrossnelson","description":"Produces confusion matrix and related statistics.","archived":false,"fork":false,"pushed_at":"2018-05-09T16:48:59.000Z","size":43,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-21T15:04:24.084Z","etag":null,"topics":["bayes","bayesian-inference","classification-algorithm","stata"],"latest_commit_sha":null,"homepage":"","language":"Stata","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adamrossnelson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-02T20:50:03.000Z","updated_at":"2018-05-09T16:49:00.000Z","dependencies_parsed_at":"2024-04-16T01:30:27.167Z","dependency_job_id":null,"html_url":"https://github.com/adamrossnelson/conmtrx","commit_stats":null,"previous_names":["adamrossnelson/conmtrx"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adamrossnelson/conmtrx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamrossnelson%2Fconmtrx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamrossnelson%2Fconmtrx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamrossnelson%2Fconmtrx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamrossnelson%2Fconmtrx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adamrossnelson","download_url":"https://codeload.github.com/adamrossnelson/conmtrx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamrossnelson%2Fconmtrx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30084685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T13:22:36.021Z","status":"ssl_error","status_checked_at":"2026-03-04T13:20:45.750Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bayes","bayesian-inference","classification-algorithm","stata"],"created_at":"2024-11-11T17:39:48.077Z","updated_at":"2026-03-04T15:01:45.765Z","avatar_url":"https://github.com/adamrossnelson.png","language":"Stata","funding_links":[],"categories":[],"sub_categories":[],"readme":"# conmtrx.ado\nProduces confusion matrix and related statistics.\n\nThis code is an extension of: https://ideas.repec.org/c/boc/bocode/s458127.html\n\nAlso inspired by https://artax.karlin.mff.cuni.cz/r-help/library/caret/html/confusionMatrix.html\n\nAnother related resource https://www.statalist.org/forums/forum/general-stata-discussion/general/1371221-n-by-k-contingency-table-for-two-categorical-variable-sensitivity-specificity-ppv-npv-accuracy-calculations\n\n## See Also\n\nThe `conmtrx` package is a wrapper for `classtabi`. Another package, `conrpt` provides more flexibility and additional options.\n\n* [Classtabi Information](https://ideas.repec.org/c/boc/bocode/s458127.html)\n* [Conrpt Information](https://github.com/adamrossnelson/conrpt)\n\n## Installation\n\nUse the following to install from command line:\n\n```Stata\nnet install conmtrx, from(https://raw.githubusercontent.com/adamrossnelson/conmtrx/master)\n```\n\nUse the following to check for installation (`which` command works to check for any package). Use `ado` command to list all installed packages.\n```Stata\nwhich classtabi3\n\nwhich conmtrx\n```\n\n## Usage\n\n```\nconmtrx rowvar(binary) colvar(binary)[, ROWlabel(string) COLlabel(string) VARlab(yes)]\n```\nWhere rowvar is generally the predicted outcome while colvar is generally the actual outcome. Optionally `conmtrx` accepts a `ROWlabel(string)` and `COLlabel(string)`. \n\nAlternatively, `conmtrx` also accepts a `VARlab(yes)` option which will instruct conmtrx to use `rowvar(binary)` and `colvar(binary)` value lables.\n\nIf row or column title specified, and `VARlab(yes)` not specified, the defaults are `Classification Test Result` and `Reference Classification`.\n\nPreviously with `classtabi' the syntax was:\n```Stata\nclasstabi #a #b #c #d [, rowlabel(string) collabel(string)]\n```\nWhere each of the four figures (`#a #b #c #d`) represente one of the four probabilities.\n\n|     Negatives                           |     Positives                              |\n|-----------------------------------------|--------------------------------------------|\n| #a -- disease=0, test=0 (true negative) | #b -- disease=0, test=1 (false positive)   |\n| #c -- disease=1, test=0 (false negative)| #d -- disease=1, test=1 (true positive)    |\n\n## Also requires\n\nErlier versions required `distinct` which can be installed with `ssc install distinct` and `classtabi` also available using `ssc install classtabi`.\n\nRevised versions check for binary status using `capture confirm capture confirm numeric variable varname` and `capture assert varname == 1 | varname == 0`.\n\n## Demonstration output\n```\n. conmtrx prUnd isUnd\nSpecified variables binary. Producing confusion matrix.\n\n+----------------+\n| Key            |\n|----------------|\n|   frequency    |\n| row percentage |\n+----------------+\n\n Predicted |\n     Under |     Actual   Under\n           |         0          1 |     Total\n-----------+----------------------+----------\n         0 |        36         60 |        96 \n           |     37.50      62.50 |    100.00 \n-----------+----------------------+----------\n         1 |         2          2 |         4 \n           |     50.00      50.00 |    100.00 \n-----------+----------------------+----------\n     Total |        38         62 |       100 \n           |     38.00      62.00 |    100.00 \n\n\n           |        Actual\n Predicted |         0          1 |     Total\n-----------+----------------------+----------\n         0 |        36         60 |        96 \n         1 |         2          2 |         4 \n-----------+----------------------+----------\n     Total |        38         62 |       100 \n\n\n\n-------------------------------------------------\nSensitivity                     D/(C+D)   50.00%      \nSpecificity                     A/(A+B)   37.50%      \nPositive predictive value       D/(B+D)    3.23%      \nNegative predictive value       A/(A+C)   94.74%      \n-------------------------------------------------\nFalse positive rate             B/(A+B)   62.50%      \nFalse negative rate             C/(C+D)   50.00%      \n-------------------------------------------------\nCorrectly classified      A+C/(A+B+C+D)   38.00%      \n-------------------------------------------------\nEffect strength for sensitivity          -12.50%      \n-------------------------------------------------\nROC area                                  0.4375      \n-------------------------------------------------\n - conmtrx - Command was a succss.\n\n```\n\n## Known limitation\n\nDoes not support `if` and `in` options/statements.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamrossnelson%2Fconmtrx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamrossnelson%2Fconmtrx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamrossnelson%2Fconmtrx/lists"}