{"id":"causalReferee","title":"Causal Claim Referee","description":"Referees a causal claim against an observational table (JSON rows, CSV text, or a published contingency table with counts) and leads with a verdict, confidence, whether the claim holds, the crude and adjusted effects with bootstrap intervals, and a concrete next step. Underneath: crude and stratified effects, Mantel-Haenszel pooling, Simpson's-paradox detection, d-separation and backdoor/front-door checks with minimal adjustment sets, g-formula standardization with positivity checks, exact or seeded Monte Carlo permutation tests, and a PC-algorithm check of the DAG against the data. Verdict by code rules; with a caller-supplied DAG no model is called and the result is reproducible. Conclusions hold only under the DAG and no-unmeasured-confounding assumptions, which are listed in the output; this is statistical analysis, not a substitute for a randomized trial.","roi":"Tells a buyer whether a claimed cause-and-effect survives confounding, Simpson's reversals and unidentifiability, with reproducible numbers and a stated next step instead of an LLM opinion.","audience":"research","channels":["x402","mcp","rapidapi","apify"],"endpoint":{"method":"POST","url":"https://agents.writerslogic.com/api/v1/prove-causality","path":"/api/v1/prove-causality","contentType":"application/json"},"price":{"amount":"1.50","currency":"USDC","network":"base","perCall":true,"failedCallsCharged":false},"inputSchema":{"type":"object","additionalProperties":false,"required":["treatment","outcome","covariates","claim"],"properties":{"data":{"type":"array","minItems":2,"maxItems":20000,"items":{"type":"object"},"description":"Observational table as an array of row objects (at most 20000 rows). Cells are string, number, boolean or null; rows missing a used variable are dropped. Provide this or csv."},"csv":{"type":"string","minLength":10,"maxLength":3000000,"description":"Alternative to data: CSV text with a header line (comma, semicolon or tab separated; quoted fields allowed; at most 20000 data rows). Numeric cells become numbers."},"countColumn":{"type":"string","minLength":1,"maxLength":100,"description":"Name of a column holding how many times each row repeats, so a published contingency table can be sent as a few aggregate rows (counts must be non-negative integers; the expanded table is capped at the row limit)."},"treatment":{"type":"string","minLength":1,"maxLength":100,"description":"Column with exactly two distinct values."},"outcome":{"type":"string","minLength":1,"maxLength":100,"description":"Binary column (risk difference, risk ratio, odds ratio) or numeric column (mean difference)."},"covariates":{"type":"array","maxItems":12,"items":{"type":"string","minLength":1,"maxLength":100},"description":"Candidate adjustment variables (at most 12). Numeric ones with more than `bins` distinct values are cut at deterministic quantile edges; others must have at most 20 levels."},"claim":{"type":"string","minLength":3,"maxLength":2000,"description":"The causal claim being refereed, in plain language."},"dag":{"type":"object","additionalProperties":false,"required":["edges"],"description":"Your causal DAG (formal input: no LLM is called to build the graph or, by default, the report). Omit to have one proposed by two independent model samples, which is then an assumption.","properties":{"edges":{"type":"array","maxItems":200,"items":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"from":{"type":"string","maxLength":100},"to":{"type":"string","maxLength":100}}},"description":"Directed edges from cause to effect between the treatment, outcome, covariates and unobserved nodes."},"unobserved":{"type":"array","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":100},"description":"Latent variables that appear in edges (for example an unmeasured confounder)."}}},"treatedValue":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}],"description":"Treatment value that counts as treated; required unless the values are numeric or boolean (then the larger is treated)."},"successValue":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}],"description":"Outcome value that counts as success for a binary outcome; same default rule."},"outcomeType":{"type":"string","enum":["binary","continuous"],"description":"Force the outcome type; inferred from the number of distinct values otherwise."},"claimDirection":{"type":"string","enum":["positive","negative","nonzero"],"description":"Direction of the claimed effect of treated vs control; default nonzero."},"bins":{"type":"integer","minimum":2,"maximum":10,"description":"Quantile bins for numeric covariates, default 4."},"alpha":{"type":"number","minimum":0.001,"maximum":0.2,"description":"Significance level for the permutation test and the (1-alpha) bootstrap interval, default 0.05."},"seed":{"type":"integer","minimum":0,"maximum":4294967295,"description":"Seed for bootstrap and Monte Carlo; default derived from the input hash."},"bootstrapReps":{"type":"integer","minimum":100,"maximum":2000},"permutationSamples":{"type":"integer","minimum":1000,"maximum":200000,"description":"Used only when the exact enumeration would exceed 1000000 label assignments."},"llmReport":{"type":"boolean","description":"Ask a model to write the executive report in prose (numbers verified in code, template fallback). Default false: the report is a deterministic template over the computed results."},"descriptions":{"type":"object","description":"Optional one-line description per variable, used only to propose the DAG."}}},"resultSchema":{"type":"object","properties":{"headline":{"type":"object","description":"Verdict-first digest computed in code: verdict, confidence, claimSupported (true, false or null when undecidable), crude and adjusted effect with bootstrap intervals, dagSource, a one-sentence summary and a concrete nextStep."},"deterministic":{"type":"boolean","description":"True only for the formal-IR path (caller DAG): no model output can influence the verdict. False when the DAG came from a model or from the outage fallback."},"status":{"type":"string","enum":["OK","BUDGET_EXCEEDED"]},"verdict":{"type":"string","enum":["SUPPORTED_UNDER_ASSUMPTIONS","CONFOUNDED","SIMPSONS_REVERSAL","NOT_IDENTIFIABLE","INSUFFICIENT_DATA","NOT_SUPPORTED"]},"verdictRule":{"type":"string"},"confidence":{"type":"string","enum":["low","medium","high"]},"reasons":{"type":"array","items":{"type":"string"}},"claim":{"type":"string"},"claimEvaluation":{"type":"object"},"data":{"type":"object"},"dag":{"type":"object","description":"The graph used, its source (caller, llm_proposed, default_all_confounders) and whether it is an assumption."},"identification":{"type":"object","description":"Minimal backdoor adjustment sets, front-door sets, and variables not to adjust for (mediators, colliders, post-treatment)."},"effects":{"type":"object","description":"Crude and adjusted risk difference / risk ratio / odds ratio or mean difference with seeded bootstrap intervals."},"tests":{"type":"object","description":"Exact or Monte Carlo permutation p-values (within strata for the adjusted test), Fisher exact, Mantel-Haenszel test."},"stratification":{"type":"object"},"simpson":{"type":"object"},"dagCheck":{"type":"object","description":"PC-algorithm skeleton and orientations from the data, and the conflicts with the assumed DAG."},"caveats":{"type":"array","items":{"type":"string"}},"assumptions":{"type":"array","items":{"type":"string"}},"report":{"type":"object","description":"Executive report; source is llm only if every number in it appears in the computed results."},"translation":{"anyOf":[{"type":"object"},{"type":"null"}]},"audit":{"type":"object"}}},"outputSchema":{"type":"object","properties":{"data":{"type":"object","properties":{"headline":{"type":"object","description":"Verdict-first digest computed in code: verdict, confidence, claimSupported (true, false or null when undecidable), crude and adjusted effect with bootstrap intervals, dagSource, a one-sentence summary and a concrete nextStep."},"deterministic":{"type":"boolean","description":"True only for the formal-IR path (caller DAG): no model output can influence the verdict. False when the DAG came from a model or from the outage fallback."},"status":{"type":"string","enum":["OK","BUDGET_EXCEEDED"]},"verdict":{"type":"string","enum":["SUPPORTED_UNDER_ASSUMPTIONS","CONFOUNDED","SIMPSONS_REVERSAL","NOT_IDENTIFIABLE","INSUFFICIENT_DATA","NOT_SUPPORTED"]},"verdictRule":{"type":"string"},"confidence":{"type":"string","enum":["low","medium","high"]},"reasons":{"type":"array","items":{"type":"string"}},"claim":{"type":"string"},"claimEvaluation":{"type":"object"},"data":{"type":"object"},"dag":{"type":"object","description":"The graph used, its source (caller, llm_proposed, default_all_confounders) and whether it is an assumption."},"identification":{"type":"object","description":"Minimal backdoor adjustment sets, front-door sets, and variables not to adjust for (mediators, colliders, post-treatment)."},"effects":{"type":"object","description":"Crude and adjusted risk difference / risk ratio / odds ratio or mean difference with seeded bootstrap intervals."},"tests":{"type":"object","description":"Exact or Monte Carlo permutation p-values (within strata for the adjusted test), Fisher exact, Mantel-Haenszel test."},"stratification":{"type":"object"},"simpson":{"type":"object"},"dagCheck":{"type":"object","description":"PC-algorithm skeleton and orientations from the data, and the conflicts with the assumed DAG."},"caveats":{"type":"array","items":{"type":"string"}},"assumptions":{"type":"array","items":{"type":"string"}},"report":{"type":"object","description":"Executive report; source is llm only if every number in it appears in the computed results."},"translation":{"anyOf":[{"type":"object"},{"type":"null"}]},"audit":{"type":"object"}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]},"example":{"data":[{"treatment":"A","stone_size":"small","success":1,"n":81},{"treatment":"A","stone_size":"small","success":0,"n":6},{"treatment":"A","stone_size":"large","success":1,"n":192},{"treatment":"A","stone_size":"large","success":0,"n":71},{"treatment":"B","stone_size":"small","success":1,"n":234},{"treatment":"B","stone_size":"small","success":0,"n":36},{"treatment":"B","stone_size":"large","success":1,"n":55},{"treatment":"B","stone_size":"large","success":0,"n":25}],"countColumn":"n","treatment":"treatment","outcome":"success","covariates":["stone_size"],"treatedValue":"B","claim":"Treatment B causes a higher recovery rate than treatment A.","claimDirection":"positive","dag":{"edges":[{"from":"stone_size","to":"treatment"},{"from":"stone_size","to":"success"},{"from":"treatment","to":"success"}]}},"openapiOperation":{"operationId":"causalReferee","summary":"Causal Claim Referee","description":"Referees a causal claim against an observational table (JSON rows, CSV text, or a published contingency table with counts) and leads with a verdict, confidence, whether the claim holds, the crude and adjusted effects with bootstrap intervals, and a concrete next step. Underneath: crude and stratified effects, Mantel-Haenszel pooling, Simpson's-paradox detection, d-separation and backdoor/front-door checks with minimal adjustment sets, g-formula standardization with positivity checks, exact or seeded Monte Carlo permutation tests, and a PC-algorithm check of the DAG against the data. Verdict by code rules; with a caller-supplied DAG no model is called and the result is reproducible. Conclusions hold only under the DAG and no-unmeasured-confounding assumptions, which are listed in the output; this is statistical analysis, not a substitute for a randomized trial.\n\nPrice: 1.50 USDC on Base (x402).","x-x402-price-usdc":"1.50","x-x402-amount":"1500000","x-payment-info":{"protocols":["x402"],"price":{"mode":"fixed","currency":"USD","amount":"1.50"}},"x-audience":"research","x-sample-url":"https://agents.writerslogic.com/api/v1/samples/causalReferee","security":[{"x402":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["treatment","outcome","covariates","claim"],"properties":{"data":{"type":"array","minItems":2,"maxItems":20000,"items":{"type":"object"},"description":"Observational table as an array of row objects (at most 20000 rows). Cells are string, number, boolean or null; rows missing a used variable are dropped. Provide this or csv."},"csv":{"type":"string","minLength":10,"maxLength":3000000,"description":"Alternative to data: CSV text with a header line (comma, semicolon or tab separated; quoted fields allowed; at most 20000 data rows). Numeric cells become numbers."},"countColumn":{"type":"string","minLength":1,"maxLength":100,"description":"Name of a column holding how many times each row repeats, so a published contingency table can be sent as a few aggregate rows (counts must be non-negative integers; the expanded table is capped at the row limit)."},"treatment":{"type":"string","minLength":1,"maxLength":100,"description":"Column with exactly two distinct values."},"outcome":{"type":"string","minLength":1,"maxLength":100,"description":"Binary column (risk difference, risk ratio, odds ratio) or numeric column (mean difference)."},"covariates":{"type":"array","maxItems":12,"items":{"type":"string","minLength":1,"maxLength":100},"description":"Candidate adjustment variables (at most 12). Numeric ones with more than `bins` distinct values are cut at deterministic quantile edges; others must have at most 20 levels."},"claim":{"type":"string","minLength":3,"maxLength":2000,"description":"The causal claim being refereed, in plain language."},"dag":{"type":"object","additionalProperties":false,"required":["edges"],"description":"Your causal DAG (formal input: no LLM is called to build the graph or, by default, the report). Omit to have one proposed by two independent model samples, which is then an assumption.","properties":{"edges":{"type":"array","maxItems":200,"items":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"from":{"type":"string","maxLength":100},"to":{"type":"string","maxLength":100}}},"description":"Directed edges from cause to effect between the treatment, outcome, covariates and unobserved nodes."},"unobserved":{"type":"array","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":100},"description":"Latent variables that appear in edges (for example an unmeasured confounder)."}}},"treatedValue":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}],"description":"Treatment value that counts as treated; required unless the values are numeric or boolean (then the larger is treated)."},"successValue":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}],"description":"Outcome value that counts as success for a binary outcome; same default rule."},"outcomeType":{"type":"string","enum":["binary","continuous"],"description":"Force the outcome type; inferred from the number of distinct values otherwise."},"claimDirection":{"type":"string","enum":["positive","negative","nonzero"],"description":"Direction of the claimed effect of treated vs control; default nonzero."},"bins":{"type":"integer","minimum":2,"maximum":10,"description":"Quantile bins for numeric covariates, default 4."},"alpha":{"type":"number","minimum":0.001,"maximum":0.2,"description":"Significance level for the permutation test and the (1-alpha) bootstrap interval, default 0.05."},"seed":{"type":"integer","minimum":0,"maximum":4294967295,"description":"Seed for bootstrap and Monte Carlo; default derived from the input hash."},"bootstrapReps":{"type":"integer","minimum":100,"maximum":2000},"permutationSamples":{"type":"integer","minimum":1000,"maximum":200000,"description":"Used only when the exact enumeration would exceed 1000000 label assignments."},"llmReport":{"type":"boolean","description":"Ask a model to write the executive report in prose (numbers verified in code, template fallback). Default false: the report is a deterministic template over the computed results."},"descriptions":{"type":"object","description":"Optional one-line description per variable, used only to propose the DAG."}}},"example":{"data":[{"treatment":"A","stone_size":"small","success":1,"n":81},{"treatment":"A","stone_size":"small","success":0,"n":6},{"treatment":"A","stone_size":"large","success":1,"n":192},{"treatment":"A","stone_size":"large","success":0,"n":71},{"treatment":"B","stone_size":"small","success":1,"n":234},{"treatment":"B","stone_size":"small","success":0,"n":36},{"treatment":"B","stone_size":"large","success":1,"n":55},{"treatment":"B","stone_size":"large","success":0,"n":25}],"countColumn":"n","treatment":"treatment","outcome":"success","covariates":["stone_size"],"treatedValue":"B","claim":"Treatment B causes a higher recovery rate than treatment A.","claimDirection":"positive","dag":{"edges":[{"from":"stone_size","to":"treatment"},{"from":"stone_size","to":"success"},{"from":"treatment","to":"success"}]}}}}},"responses":{"200":{"description":"Paid result with provenance","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"headline":{"type":"object","description":"Verdict-first digest computed in code: verdict, confidence, claimSupported (true, false or null when undecidable), crude and adjusted effect with bootstrap intervals, dagSource, a one-sentence summary and a concrete nextStep."},"deterministic":{"type":"boolean","description":"True only for the formal-IR path (caller DAG): no model output can influence the verdict. False when the DAG came from a model or from the outage fallback."},"status":{"type":"string","enum":["OK","BUDGET_EXCEEDED"]},"verdict":{"type":"string","enum":["SUPPORTED_UNDER_ASSUMPTIONS","CONFOUNDED","SIMPSONS_REVERSAL","NOT_IDENTIFIABLE","INSUFFICIENT_DATA","NOT_SUPPORTED"]},"verdictRule":{"type":"string"},"confidence":{"type":"string","enum":["low","medium","high"]},"reasons":{"type":"array","items":{"type":"string"}},"claim":{"type":"string"},"claimEvaluation":{"type":"object"},"data":{"type":"object"},"dag":{"type":"object","description":"The graph used, its source (caller, llm_proposed, default_all_confounders) and whether it is an assumption."},"identification":{"type":"object","description":"Minimal backdoor adjustment sets, front-door sets, and variables not to adjust for (mediators, colliders, post-treatment)."},"effects":{"type":"object","description":"Crude and adjusted risk difference / risk ratio / odds ratio or mean difference with seeded bootstrap intervals."},"tests":{"type":"object","description":"Exact or Monte Carlo permutation p-values (within strata for the adjusted test), Fisher exact, Mantel-Haenszel test."},"stratification":{"type":"object"},"simpson":{"type":"object"},"dagCheck":{"type":"object","description":"PC-algorithm skeleton and orientations from the data, and the conflicts with the assumed DAG."},"caveats":{"type":"array","items":{"type":"string"}},"assumptions":{"type":"array","items":{"type":"string"}},"report":{"type":"object","description":"Executive report; source is llm only if every number in it appears in the computed results."},"translation":{"anyOf":[{"type":"object"},{"type":"null"}]},"audit":{"type":"object"}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]}}}},"400":{"description":"Invalid request (no payment consumed)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"401":{"description":"Invalid X-API-KEY","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"402":{"description":"Payment required or invalid","content":{"application/json":{"schema":{"type":"object","description":"x402 v2 PaymentRequired (also base64 in the PAYMENT-REQUIRED header)","properties":{"x402Version":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"resource":{"type":"object"},"accepts":{"type":"array","items":{"type":"object"}},"extensions":{"type":"object"}}}}}},"502":{"description":"Upstream failure; the payment is released or not settled","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}}}},"links":{"docs":"https://agents.writerslogic.com/docs/causalReferee/","docsJson":"https://agents.writerslogic.com/docs/causalReferee.json","sample":"https://agents.writerslogic.com/api/v1/samples/causalReferee","openapi":"https://agents.writerslogic.com/openapi.json","catalog":"https://agents.writerslogic.com/api/v1/catalog","verifyProvenance":"https://agents.writerslogic.com/api/v1/verify-provenance","index":"https://agents.writerslogic.com/docs/index.json"}}