← All procedures

statistics.eloExpected

The expected score of the first item against the second item: `1 / (1 + base ** ((rb - ra) / scale))`. A win counts 1, a tie 0.5 and a loss 0. The expected score of the second item is 1 minus this value.

CLI
Package
@procedures/statistics · README
Path
["statistics","eloExpected"]
CLI
mark statistics eloExpected --ra <number> --rb <number>
As data
{"$proc":["statistics","eloExpected"],"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","eloExpected"], { ra: 1, rb: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark statistics eloExpected --ra <number> --rb <number>

As data, in a program

{
  "$proc": ["statistics", "eloExpected"],
  "input": { "ra": 1, "rb": 1 }
}

Input

FieldTypeRequiredDefaultDescription
ranumberyes
rbnumberyes
optionsobjectno

Output

The schema does not list fields (number).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "ra": {
        "type": "number"
      },
      "rb": {
        "type": "number"
      },
      "options": {
        "type": "object",
        "properties": {
          "center": {
            "type": "number",
            "description": "The rating of the log-strength 0. The default is 1500. Elo uses only differences, so it does not read it."
          },
          "scale": {
            "type": "number",
            "description": "The number of points that gives odds of `base` to 1. The default is 400."
          },
          "base": {
            "type": "number",
            "description": "The base of the odds. The default is 10."
          }
        },
        "additionalProperties": {}
      }
    },
    "required": [
      "ra",
      "rb"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "number"
  }
}