← All procedures

statistics.pairProbabilities

The probabilities of a pair under the Bradley-Terry model with Davidson (1970) ties. The inputs are the log-strengths of the two items and the tie parameter `tie` of `bradleyTerry`. With `tie` 0, the probability that the first item wins is `1 / (1 + exp(sb - sa))`. A constant added to the two strengths changes no probability.

CLI
Package
@procedures/statistics · README
Path
["statistics","pairProbabilities"]
CLI
mark statistics pairProbabilities --sa <number> --sb <number>
As data
{"$proc":["statistics","pairProbabilities"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/statistics/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["statistics","pairProbabilities"], { sa: 1, sb: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark statistics pairProbabilities --sa <number> --sb <number>

As data, in a program

{
  "$proc": ["statistics", "pairProbabilities"],
  "input": { "sa": 1, "sb": 1 }
}

Input

FieldTypeRequiredDefaultDescription
sanumberyes
sbnumberyes
tienumberno

Output

FieldTypeRequiredDefaultDescription
anumberyesThe probability that the first item wins.
bnumberyesThe probability that the second item wins.
tienumberyesThe probability of a tie. It is 0 when the tie parameter is 0.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "sa": {
        "type": "number"
      },
      "sb": {
        "type": "number"
      },
      "tie": {
        "type": "number"
      }
    },
    "required": [
      "sa",
      "sb"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "a": {
        "type": "number",
        "description": "The probability that the first item wins."
      },
      "b": {
        "type": "number",
        "description": "The probability that the second item wins."
      },
      "tie": {
        "type": "number",
        "description": "The probability of a tie. It is 0 when the tie parameter is 0."
      }
    },
    "required": [
      "a",
      "b",
      "tie"
    ],
    "additionalProperties": {}
  }
}