{
  "title": "Diagnostic accuracy calculator",
  "human_url": "https://happytails.ai/en/calculators/diagnostic-accuracy-calculator/",
  "agent_url": "https://happytails.ai/agents/en/calculators/diagnostic-accuracy-calculator/",
  "language": "en",
  "markdown_url": "https://happytails.ai/en/calculators/diagnostic-accuracy-calculator.md",
  "content": "Diagnostic accuracy calculator\nCompute sensitivity, specificity, predictive values, likelihood ratios and other accuracy metrics with confidence intervals from a confusion matrix or labelled rows. It describes test performance on your data and gives no clinical advice.\nHow can we improve this tool?\nReport a problem or share an idea.\nPlease leave out private information. Your message and the tool name go to our team via PostHog.\nHow to use Diagnostic accuracy calculator\nEnter the four confusion counts, or switch to labelled CSV rows with actual and predicted columns.\nOptionally enter a declared prevalence to see predictive values for another population.\nChoose Wilson or Clopper-Pearson intervals and the confidence level.\nCalculate and download the JSON report or the CSV metrics table.\nUseful next steps\nConfidence interval calculator\nAgreement analysis\nProbability calculator\nWhat is computed\nSensitivity, specificity, PPV, NPV, accuracy and sample prevalence are proportions with Wilson score intervals (Wilson 1927, JASA 22:209) or Clopper-Pearson exact intervals (Clopper and Pearson 1934, Biometrika 26:404). Likelihood ratios use log intervals (Simel, Samsa and Matchar 1991, J Clin Epidemiol 44:763). Balanced accuracy, F1, Youden J, the diagnostic odds ratio and the Matthews correlation (Matthews 1975) are point estimates.\nPrevalence changes predictive values\nPPV and NPV from the table use the sample prevalence. If you declare a prevalence, the tool also reports predictive values from Bayes' rule with your sensitivity and specificity, which is how a test behaves where the condition is more or less common. No interval is given for those adjusted values.\nLimits\nA ratio with a zero denominator is reported as not defined. A likelihood ratio interval is also not defined when the ratio is 0, or when sensitivity and specificity are both 0 or 1 (its log standard error is then zero). Results describe the supplied cases only; they are not clinical advice and do not interpret any patient's result.",
  "content_format": "text/plain",
  "visibility": "public",
  "links": [
    {
      "name": "Confidence interval calculator",
      "url": "https://happytails.ai/en/calculators/confidence-interval-calculator/"
    },
    {
      "name": "Agreement analysis",
      "url": "https://happytails.ai/en/calculators/agreement-analysis/"
    },
    {
      "name": "Probability calculator",
      "url": "https://happytails.ai/en/calculators/probability-calculator/"
    }
  ],
  "tool": {
    "id": "diagnostic-accuracy-calculator",
    "category": "calculators",
    "built": true,
    "requirements": "Runs locally in your browser; nothing is uploaded. Counts are whole numbers from 0 to 2,500,000 with at least one actual positive and one actual negative. Labelled CSV uses the headers actual and predicted, no blank cells and exactly two labels that match exactly, including capital letters and spaces, up to 10,000 rows and 1,000,000 characters. Declared prevalence is strictly between 0 and 1. Downloads: a JSON report plus CSV metrics and confusion tables.",
    "implementation": {
      "fields": [
        {
          "key": "data",
          "label": "Data",
          "value": "counts",
          "type": "select",
          "values": [
            "counts",
            "labels"
          ],
          "labels": {
            "counts": "Confusion counts",
            "labels": "Labelled CSV rows"
          }
        },
        {
          "key": "tp",
          "label": "True positives",
          "value": "90",
          "type": "text",
          "maxLength": 40,
          "help": "Whole number of zero or more.",
          "showWhen": {
            "data": [
              "counts"
            ]
          }
        },
        {
          "key": "fp",
          "label": "False positives",
          "value": "15",
          "type": "text",
          "maxLength": 40,
          "help": "Whole number of zero or more.",
          "showWhen": {
            "data": [
              "counts"
            ]
          }
        },
        {
          "key": "fn",
          "label": "False negatives",
          "value": "10",
          "type": "text",
          "maxLength": 40,
          "help": "Whole number of zero or more.",
          "showWhen": {
            "data": [
              "counts"
            ]
          }
        },
        {
          "key": "tn",
          "label": "True negatives",
          "value": "185",
          "type": "text",
          "maxLength": 40,
          "help": "Whole number of zero or more.",
          "showWhen": {
            "data": [
              "counts"
            ]
          }
        },
        {
          "key": "csv",
          "label": "Labelled CSV",
          "value": "actual,predicted\npositive,positive\npositive,negative\nnegative,negative\nnegative,positive\nnegative,negative",
          "type": "textarea",
          "maxLength": 1000000,
          "help": "Headers actual and predicted, one case per row, exactly two labels in total. Up to 10,000 rows and 1,000,000 characters.",
          "showWhen": {
            "data": [
              "labels"
            ]
          }
        },
        {
          "key": "positiveLabel",
          "label": "Positive label",
          "value": "positive",
          "type": "text",
          "maxLength": 80,
          "help": "The exact label that means the condition is present.",
          "showWhen": {
            "data": [
              "labels"
            ]
          }
        },
        {
          "key": "prevalence",
          "label": "Declared prevalence (optional)",
          "value": "0.05",
          "type": "text",
          "maxLength": 40,
          "help": "A proportion between 0 and 1 for predictive values in another population. Leave blank to use only the sample."
        },
        {
          "key": "interval",
          "label": "Interval method",
          "value": "wilson",
          "type": "select",
          "values": [
            "wilson",
            "clopper-pearson"
          ],
          "labels": {
            "wilson": "Wilson score",
            "clopper-pearson": "Clopper-Pearson exact"
          }
        },
        {
          "key": "confidence",
          "label": "Confidence level",
          "value": "0.95",
          "type": "text",
          "maxLength": 40,
          "help": "A proportion from 0.5 to 0.9999, for example 0.95."
        }
      ],
      "registrationFamily": "statistical-analysis-reference",
      "input": false,
      "note": "Runs on your device. Enter confusion counts or up to 1,000,000 characters of labelled CSV. Results describe the supplied data and are not clinical advice.",
      "experience": {
        "automatic": false,
        "single": false,
        "inputMaxLength": 1000000,
        "inputMode": "text",
        "label": "Confusion counts",
        "placeholder": "Enter counts in the form fields",
        "help": "Use the fields for counts, or choose Labelled CSV rows to paste data. Up to 1,000,000 characters. Review the settings before running.",
        "action": null
      },
      "mode": "explicit",
      "interactive": false
    },
    "execution": "Browser interface",
    "api": null,
    "browser_agent": {
      "supported": true,
      "name": "run_current_tool",
      "discovery": "WebMCP on the human page in a supporting browser",
      "verification": "See audit/API-AUDIT.md; availability is not verification"
    }
  },
  "markdown": "# Diagnostic accuracy calculator\n\n- Human page: https://happytails.ai/en/calculators/diagnostic-accuracy-calculator/\n- Markdown: https://happytails.ai/en/calculators/diagnostic-accuracy-calculator.md\n- Structured JSON: https://happytails.ai/agents/en/calculators/diagnostic-accuracy-calculator/index.json\n- Visibility: public\n\n## Tool capabilities\n\n| Property | Value |\n| --- | --- |\n| Tool ID | `diagnostic-accuracy-calculator` |\n| Category | calculators |\n| Implementation | Registered implementation. Registration alone is not a production-quality guarantee. |\n| Browser execution | Use the visible action or interactive controls. |\n| Browser processing | Browser; see tool notes for network behavior. |\n| HTTP API | Not callable through HTTP. |\n| Browser-agent interface | run_current_tool |\n\n### Implementation notes\n\nRuns on your device. Enter confusion counts or up to 1,000,000 characters of labelled CSV. Results describe the supplied data and are not clinical advice.\n\n### Inputs and settings\n\nNo free-text input is required. Use the file inputs and/or settings below.\n\n| Setting | Meaning | Control type | Default | Constraints |\n| --- | --- | --- | --- | --- |\n| `data` | Data | select | \"counts\" | Allowed: counts, labels |\n| `tp` | True positives | text | \"90\" |  |\n| `fp` | False positives | text | \"15\" |  |\n| `fn` | False negatives | text | \"10\" |  |\n| `tn` | True negatives | text | \"185\" |  |\n| `csv` | Labelled CSV | textarea | \"actual,predicted\\npositive,positive\\npositive,negative\\nnegative,negative\\nnegative,positive\\nnegative,negative\" |  |\n| `positiveLabel` | Positive label | text | \"positive\" |  |\n| `prevalence` | Declared prevalence (optional) | text | \"0.05\" |  |\n| `interval` | Interval method | select | \"wilson\" | Allowed: wilson, clopper-pearson |\n| `confidence` | Confidence level | text | \"0.95\" |  |\n\n### Browser-agent workflow\n\n1. Open the human page in a browser that supports WebMCP.\n2. Discover the interface exposed by that page; use its actual schema.\n3. Select files on the page first when the tool requires files.\n4. Call `run_current_tool` with valid input and settings.\n5. Inspect the returned result or error and the displayed output. Retrieve files from the displayed download links.\n\nCalls do not automatically copy or download results. Browser permissions still apply. Interface availability alone is not proof of successful execution.\n\n### Planning specification\n\nRuns locally in your browser; nothing is uploaded. Counts are whole numbers from 0 to 2,500,000 with at least one actual positive and one actual negative. Labelled CSV uses the headers actual and predicted, no blank cells and exactly two labels that match exactly, including capital letters and spaces, up to 10,000 rows and 1,000,000 characters. Declared prevalence is strictly between 0 and 1. Downloads: a JSON report plus CSV metrics and confusion tables.\n\nThis describes intended requirements. Use the implementation notes, interface schema and observed output to determine current support.\n\n### Complete machine-readable capability record\n\n```json\n{\n  \"id\": \"diagnostic-accuracy-calculator\",\n  \"category\": \"calculators\",\n  \"built\": true,\n  \"requirements\": \"Runs locally in your browser; nothing is uploaded. Counts are whole numbers from 0 to 2,500,000 with at least one actual positive and one actual negative. Labelled CSV uses the headers actual and predicted, no blank cells and exactly two labels that match exactly, including capital letters and spaces, up to 10,000 rows and 1,000,000 characters. Declared prevalence is strictly between 0 and 1. Downloads: a JSON report plus CSV metrics and confusion tables.\",\n  \"implementation\": {\n    \"fields\": [\n      {\n        \"key\": \"data\",\n        \"label\": \"Data\",\n        \"value\": \"counts\",\n        \"type\": \"select\",\n        \"values\": [\n          \"counts\",\n          \"labels\"\n        ],\n        \"labels\": {\n          \"counts\": \"Confusion counts\",\n          \"labels\": \"Labelled CSV rows\"\n        }\n      },\n      {\n        \"key\": \"tp\",\n        \"label\": \"True positives\",\n        \"value\": \"90\",\n        \"type\": \"text\",\n        \"maxLength\": 40,\n        \"help\": \"Whole number of zero or more.\",\n        \"showWhen\": {\n          \"data\": [\n            \"counts\"\n          ]\n        }\n      },\n      {\n        \"key\": \"fp\",\n        \"label\": \"False positives\",\n        \"value\": \"15\",\n        \"type\": \"text\",\n        \"maxLength\": 40,\n        \"help\": \"Whole number of zero or more.\",\n        \"showWhen\": {\n          \"data\": [\n            \"counts\"\n          ]\n        }\n      },\n      {\n        \"key\": \"fn\",\n        \"label\": \"False negatives\",\n        \"value\": \"10\",\n        \"type\": \"text\",\n        \"maxLength\": 40,\n        \"help\": \"Whole number of zero or more.\",\n        \"showWhen\": {\n          \"data\": [\n            \"counts\"\n          ]\n        }\n      },\n      {\n        \"key\": \"tn\",\n        \"label\": \"True negatives\",\n        \"value\": \"185\",\n        \"type\": \"text\",\n        \"maxLength\": 40,\n        \"help\": \"Whole number of zero or more.\",\n        \"showWhen\": {\n          \"data\": [\n            \"counts\"\n          ]\n        }\n      },\n      {\n        \"key\": \"csv\",\n        \"label\": \"Labelled CSV\",\n        \"value\": \"actual,predicted\\npositive,positive\\npositive,negative\\nnegative,negative\\nnegative,positive\\nnegative,negative\",\n        \"type\": \"textarea\",\n        \"maxLength\": 1000000,\n        \"help\": \"Headers actual and predicted, one case per row, exactly two labels in total. Up to 10,000 rows and 1,000,000 characters.\",\n        \"showWhen\": {\n          \"data\": [\n            \"labels\"\n          ]\n        }\n      },\n      {\n        \"key\": \"positiveLabel\",\n        \"label\": \"Positive label\",\n        \"value\": \"positive\",\n        \"type\": \"text\",\n        \"maxLength\": 80,\n        \"help\": \"The exact label that means the condition is present.\",\n        \"showWhen\": {\n          \"data\": [\n            \"labels\"\n          ]\n        }\n      },\n      {\n        \"key\": \"prevalence\",\n        \"label\": \"Declared prevalence (optional)\",\n        \"value\": \"0.05\",\n        \"type\": \"text\",\n        \"maxLength\": 40,\n        \"help\": \"A proportion between 0 and 1 for predictive values in another population. Leave blank to use only the sample.\"\n      },\n      {\n        \"key\": \"interval\",\n        \"label\": \"Interval method\",\n        \"value\": \"wilson\",\n        \"type\": \"select\",\n        \"values\": [\n          \"wilson\",\n          \"clopper-pearson\"\n        ],\n        \"labels\": {\n          \"wilson\": \"Wilson score\",\n          \"clopper-pearson\": \"Clopper-Pearson exact\"\n        }\n      },\n      {\n        \"key\": \"confidence\",\n        \"label\": \"Confidence level\",\n        \"value\": \"0.95\",\n        \"type\": \"text\",\n        \"maxLength\": 40,\n        \"help\": \"A proportion from 0.5 to 0.9999, for example 0.95.\"\n      }\n    ],\n    \"registrationFamily\": \"statistical-analysis-reference\",\n    \"input\": false,\n    \"note\": \"Runs on your device. Enter confusion counts or up to 1,000,000 characters of labelled CSV. Results describe the supplied data and are not clinical advice.\",\n    \"experience\": {\n      \"automatic\": false,\n      \"single\": false,\n      \"inputMaxLength\": 1000000,\n      \"inputMode\": \"text\",\n      \"label\": \"Confusion counts\",\n      \"placeholder\": \"Enter counts in the form fields\",\n      \"help\": \"Use the fields for counts, or choose Labelled CSV rows to paste data. Up to 1,000,000 characters. Review the settings before running.\",\n      \"action\": null\n    },\n    \"mode\": \"explicit\",\n    \"interactive\": false\n  },\n  \"execution\": \"Browser interface\",\n  \"api\": null,\n  \"browser_agent\": {\n    \"supported\": true,\n    \"name\": \"run_current_tool\",\n    \"discovery\": \"WebMCP on the human page in a supporting browser\",\n    \"verification\": \"See audit/API-AUDIT.md; availability is not verification\"\n  }\n}\n```\n\n## Page guide\n\nCompute sensitivity, specificity, predictive values, likelihood ratios and other accuracy metrics with confidence intervals from a confusion matrix or labelled rows. It describes test performance on your data and gives no clinical advice.\n\nHow can we improve this tool?\n\nReport a problem or share an idea.\n\nPlease leave out private information. Your message and the tool name go to our team via PostHog.\n\n### How to use Diagnostic accuracy calculator\n\n1. Enter the four confusion counts, or switch to labelled CSV rows with actual and predicted columns.\n2. Optionally enter a declared prevalence to see predictive values for another population.\n3. Choose Wilson or Clopper-Pearson intervals and the confidence level.\n4. Calculate and download the JSON report or the CSV metrics table.\n\n## Useful next steps\n\n- [Confidence interval calculator](https://happytails.ai/en/calculators/confidence-interval-calculator/) ([Markdown](https://happytails.ai/en/calculators/confidence-interval-calculator.md))\n\n- [Agreement analysis](https://happytails.ai/en/calculators/agreement-analysis/) ([Markdown](https://happytails.ai/en/calculators/agreement-analysis.md))\n\n- [Probability calculator](https://happytails.ai/en/calculators/probability-calculator/) ([Markdown](https://happytails.ai/en/calculators/probability-calculator.md))\n\n## What is computed\n\nSensitivity, specificity, PPV, NPV, accuracy and sample prevalence are proportions with Wilson score intervals (Wilson 1927, JASA 22:209) or Clopper-Pearson exact intervals (Clopper and Pearson 1934, Biometrika 26:404). Likelihood ratios use log intervals (Simel, Samsa and Matchar 1991, J Clin Epidemiol 44:763). Balanced accuracy, F1, Youden J, the diagnostic odds ratio and the Matthews correlation (Matthews 1975) are point estimates.\n\n### Prevalence changes predictive values\n\nPPV and NPV from the table use the sample prevalence. If you declare a prevalence, the tool also reports predictive values from Bayes' rule with your sensitivity and specificity, which is how a test behaves where the condition is more or less common. No interval is given for those adjusted values.\n\n### Limits\n\nA ratio with a zero denominator is reported as not defined. A likelihood ratio interval is also not defined when the ratio is 0, or when sensitivity and specificity are both 0 or 1 (its log standard error is then zero). Results describe the supplied cases only; they are not clinical advice and do not interpret any patient's result.\n"
}