← All procedures

statistics.sobolIndices

This function gives the first-order and the total Sobol index of each dimension of a record, for the model of `measure`. The indices are of the prediction of the model, not of the measured points.

CLI
Package
@procedures/statistics · README
Path
["statistics","sobolIndices"]
CLI
mark statistics sobolIndices --record <object> --measure <string>
As data
{"$proc":["statistics","sobolIndices"],"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","sobolIndices"], { record: {}, measure: "<measure>" });
console.log(JSON.stringify(result));

From the command line

$ mark statistics sobolIndices --record <object> --measure <string>

As data, in a program

{
  "$proc": ["statistics", "sobolIndices"],
  "input": { "record": {}, "measure": "<measure>" }
}

Input

FieldTypeRequiredDefaultDescription
recordobjectyes
measurestringyes
optionsobjectno

Output

FieldTypeRequiredDefaultDescription
measurestringyesThe id of the measure.
scale"measure" | "model"yesThe scale of the output.
nnumberyesThe number N of rows of each base matrix.
evaluationsnumberyesThe number of model evaluations: N * (d + 2).
seednumberyesThe seed as a 32-bit number.
meannumberyesThe mean of the outputs of A and B.
variancenumberyesThe variance of the outputs of A and B, with the divisor 2N.
indicesobject[]yesThe indices of each dimension of the record, in the order of the record.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "record": {
        "type": "object",
        "properties": {
          "dimensions": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "categorical"
                    },
                    "levels": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "id": {
                      "type": "string",
                      "description": "The key of the dimension in the values of a point."
                    },
                    "label": {
                      "type": "string",
                      "description": "The name that a view shows."
                    },
                    "unit": {
                      "type": "string",
                      "description": "The unit. An empty string means that the dimension has no unit."
                    },
                    "when": {
                      "type": "object",
                      "properties": {
                        "dimension": {
                          "type": "string",
                          "description": "The id of the parent: a categorical or ordinal dimension with no condition."
                        },
                        "levels": {
                          "type": "array",
                          "items": {
                            "type": [
                              "string",
                              "number"
                            ]
                          }
                        }
                      },
                      "required": [
                        "dimension",
                        "levels"
                      ],
                      "additionalProperties": {},
                      "description": "With this field, a point has a value only at the stated levels of the parent. Each other point has `null`."
                    }
                  },
                  "required": [
                    "kind",
                    "levels",
                    "id",
                    "label",
                    "unit"
                  ],
                  "additionalProperties": {}
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "continuous"
                    },
                    "range": {
                      "type": "array",
                      "items": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "number"
                        }
                      ],
                      "additionalItems": {},
                      "minItems": 2,
                      "maxItems": 2,
                      "description": "The smallest and the largest value. The first is less than the second."
                    },
                    "log": {
                      "type": "boolean",
                      "description": "When true, a model and an axis use the base-10 logarithm of the value. All of the range is above 0."
                    },
                    "id": {
                      "type": "string",
                      "description": "The key of the dimension in the values of a point."
                    },
                    "label": {
                      "type": "string",
                      "description": "The name that a view shows."
                    },
                    "unit": {
                      "type": "string",
                      "description": "The unit. An empty string means that the dimension has no unit."
                    },
                    "when": {
                      "type": "object",
                      "properties": {
                        "dimension": {
                          "type": "string",
                          "description": "The id of the parent: a categorical or ordinal dimension with no condition."
                        },
                        "levels": {
                          "type": "array",
                          "items": {
                            "type": [
                              "string",
                              "number"
                            ]
                          }
                        }
                      },
                      "required": [
                        "dimension",
                        "levels"
                      ],
                      "additionalProperties": {},
                      "description": "With this field, a point has a value only at the stated levels of the parent. Each other point has `null`."
                    }
                  },
                  "required": [
                    "kind",
                    "range",
                    "id",
                    "label",
                    "unit"
                  ],
                  "additionalProperties": {}
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "ordinal"
                    },
                    "levels": {
                      "anyOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "number"
                          }
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      ]
                    },
                    "log": {
                      "type": "boolean",
                      "description": "When true, a model uses the base-10 logarithm of the level. The levels are numbers above 0."
                    },
                    "id": {
                      "type": "string",
                      "description": "The key of the dimension in the values of a point."
                    },
                    "label": {
                      "type": "string",
                      "description": "The name that a view shows."
                    },
                    "unit": {
                      "type": "string",
                      "description": "The unit. An empty string means that the dimension has no unit."
                    },
                    "when": {
                      "type": "object",
                      "properties": {
                        "dimension": {
                          "type": "string",
                          "description": "The id of the parent: a categorical or ordinal dimension with no condition."
                        },
                        "levels": {
                          "type": "array",
                          "items": {
                            "type": [
                              "string",
                              "number"
                            ]
                          }
                        }
                      },
                      "required": [
                        "dimension",
                        "levels"
                      ],
                      "additionalProperties": {},
                      "description": "With this field, a point has a value only at the stated levels of the parent. Each other point has `null`."
                    }
                  },
                  "required": [
                    "kind",
                    "levels",
                    "id",
                    "label",
                    "unit"
                  ],
                  "additionalProperties": {}
                }
              ]
            }
          },
          "models": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "ridge"
                    },
                    "lambda": {
                      "type": "number",
                      "description": "The penalty of the fit."
                    },
                    "inputs": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "level"
                              },
                              "levels": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "dimension": {
                                "type": "string"
                              },
                              "conditional": {
                                "type": "boolean",
                                "description": "When true, the dimension is conditional, so `null` is a good value. Each term of an absent dimension is 0."
                              }
                            },
                            "required": [
                              "kind",
                              "levels",
                              "dimension"
                            ],
                            "additionalProperties": {}
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "number"
                              },
                              "center": {
                                "type": "number"
                              },
                              "spread": {
                                "type": "number"
                              },
                              "log": {
                                "type": "boolean"
                              },
                              "dimension": {
                                "type": "string"
                              },
                              "conditional": {
                                "type": "boolean",
                                "description": "When true, the dimension is conditional, so `null` is a good value. Each term of an absent dimension is 0."
                              }
                            },
                            "required": [
                              "kind",
                              "center",
                              "spread",
                              "dimension"
                            ],
                            "additionalProperties": {}
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "rank"
                              },
                              "levels": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "center": {
                                "type": "number"
                              },
                              "spread": {
                                "type": "number"
                              },
                              "dimension": {
                                "type": "string"
                              },
                              "conditional": {
                                "type": "boolean",
                                "description": "When true, the dimension is conditional, so `null` is a good value. Each term of an absent dimension is 0."
                              }
                            },
                            "required": [
                              "kind",
                              "levels",
                              "center",
                              "spread",
                              "dimension"
                            ],
                            "additionalProperties": {}
                          }
                        ]
                      }
                    },
                    "intercept": {
                      "type": "number"
                    },
                    "terms": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "factors": {
                            "type": "array",
                            "items": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "dimension": {
                                      "type": "string"
                                    },
                                    "level": {
                                      "type": [
                                        "string",
                                        "number"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "dimension",
                                    "level"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "dimension": {
                                      "type": "string"
                                    },
                                    "power": {
                                      "type": "number"
                                    }
                                  },
                                  "required": [
                                    "dimension",
                                    "power"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            }
                          },
                          "weight": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "factors",
                          "weight"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "measure": {
                      "type": "string",
                      "description": "The id of the measure of the model."
                    },
                    "scale": {
                      "type": "string",
                      "enum": [
                        "linear",
                        "log"
                      ],
                      "description": "With `log`, the model and the held-out errors use the base-10 logarithm of the measure."
                    },
                    "floor": {
                      "type": "number",
                      "description": "With the scale `log`, the fit gave this value to each smaller measured value."
                    }
                  },
                  "required": [
                    "kind",
                    "lambda",
                    "inputs",
                    "intercept",
                    "terms",
                    "measure",
                    "scale"
                  ],
                  "additionalProperties": {}
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "table"
                    },
                    "dimensions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "conditional": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The ids of the dimensions of the table with a condition. Only these dimensions take `null`."
                    },
                    "cells": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "at": {
                            "type": "array",
                            "items": {
                              "type": [
                                "null",
                                "string",
                                "number"
                              ]
                            },
                            "description": "The value of each dimension of the table, in the order of its `dimensions`. An absent dimension has `null`."
                          },
                          "value": {
                            "type": "number",
                            "description": "The mean of the measured values of the cell, on the scale of the model."
                          },
                          "n": {
                            "type": "number",
                            "description": "The number of points of the cell."
                          }
                        },
                        "required": [
                          "at",
                          "value",
                          "n"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "fallback": {
                      "type": "number",
                      "description": "The value of a combination with no cell: the mean of all the fitted points, on the scale of the model."
                    },
                    "measure": {
                      "type": "string",
                      "description": "The id of the measure of the model."
                    },
                    "scale": {
                      "type": "string",
                      "enum": [
                        "linear",
                        "log"
                      ],
                      "description": "With `log`, the model and the held-out errors use the base-10 logarithm of the measure."
                    },
                    "floor": {
                      "type": "number",
                      "description": "With the scale `log`, the fit gave this value to each smaller measured value."
                    }
                  },
                  "required": [
                    "kind",
                    "dimensions",
                    "cells",
                    "fallback",
                    "measure",
                    "scale"
                  ],
                  "additionalProperties": {}
                }
              ]
            }
          }
        },
        "required": [
          "dimensions",
          "models"
        ],
        "additionalProperties": {}
      },
      "measure": {
        "type": "string"
      },
      "options": {
        "type": "object",
        "properties": {
          "n": {
            "type": "number",
            "description": "The number N of rows of each base matrix. The default is 4096."
          },
          "seed": {
            "description": "The seed of the draws. The default is 1.",
            "type": [
              "string",
              "number"
            ]
          },
          "scale": {
            "type": "string",
            "enum": [
              "measure",
              "model"
            ],
            "description": "The scale of the output. The value `measure` uses `predictResponse`. The value `model` uses the scale of the model, so a model with a log scale gives the indices of the logarithm. The default is `measure`."
          },
          "interval": {
            "type": "object",
            "properties": {
              "runs": {
                "type": "number",
                "description": "The number of samples. The default is 10 000."
              },
              "level": {
                "type": "number",
                "description": "The level of the interval. The default is 0.95."
              },
              "seed": {
                "description": "The seed of the draws. The default is 1.",
                "type": [
                  "string",
                  "number"
                ]
              },
              "method": {
                "type": "string",
                "enum": [
                  "higher",
                  "linear",
                  "nearest-rank"
                ],
                "description": "The quantile method of the two ends of the interval. The default is linear."
              },
              "ends": {
                "type": "array",
                "items": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "number"
                  }
                ],
                "additionalItems": {},
                "minItems": 2,
                "maxItems": 2,
                "description": "The quantiles of the two ends, in place of `level`, for example [0.025, 0.975] or an interval with one side. The default is from the level: (1 - level) / 2 and 1 - (1 - level) / 2. In floating point, (1 - 0.95) / 2 is not 0.025, so a copy that writes 0.025 needs this option to give the same numbers."
              },
              "against": {
                "type": "number",
                "description": "The value of a claim to test, for example 0 for \"no difference\". With this option, the interval also gives `pAbove` and `pBelow` from the same draws, so the ends do not change. The default is no value and no p."
              }
            },
            "additionalProperties": {},
            "description": "With this option, each index also gets a percentile bootstrap interval over the N rows. Each run draws N rows with replacement, and it calculates all the indices from these rows. The default is no interval."
          }
        },
        "additionalProperties": {}
      }
    },
    "required": [
      "record",
      "measure"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "measure": {
        "type": "string",
        "description": "The id of the measure."
      },
      "scale": {
        "type": "string",
        "enum": [
          "measure",
          "model"
        ],
        "description": "The scale of the output."
      },
      "n": {
        "type": "number",
        "description": "The number N of rows of each base matrix."
      },
      "evaluations": {
        "type": "number",
        "description": "The number of model evaluations: N * (d + 2)."
      },
      "seed": {
        "type": "number",
        "description": "The seed as a 32-bit number."
      },
      "mean": {
        "type": "number",
        "description": "The mean of the outputs of A and B."
      },
      "variance": {
        "type": "number",
        "description": "The variance of the outputs of A and B, with the divisor 2N."
      },
      "indices": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "dimension": {
              "type": "string",
              "description": "The id of the dimension."
            },
            "first": {
              "type": "number",
              "description": "The first-order index S_i: the estimator of Saltelli (2010)."
            },
            "total": {
              "type": "number",
              "description": "The total index ST_i: the estimator of Jansen (1999)."
            },
            "firstInterval": {
              "type": "object",
              "properties": {
                "estimate": {
                  "type": "number",
                  "description": "The statistic of all the data."
                },
                "low": {
                  "type": "number"
                },
                "high": {
                  "type": "number"
                },
                "level": {
                  "type": "number"
                },
                "runs": {
                  "type": "number"
                },
                "finite": {
                  "type": "number",
                  "description": "The number of runs whose statistic is a finite number. Only these runs make the interval."
                },
                "seed": {
                  "type": "number",
                  "description": "The seed as a 32-bit number."
                },
                "against": {
                  "type": "number",
                  "description": "The value of the option `against`."
                },
                "pAbove": {
                  "type": "number",
                  "description": "The p of the claim \"the statistic is above `against`\": (1 + the finite runs at or below `against`) / (finite + 1)."
                },
                "pBelow": {
                  "type": "number",
                  "description": "The p of the claim \"the statistic is below `against`\": (1 + the finite runs at or above `against`) / (finite + 1)."
                }
              },
              "required": [
                "estimate",
                "low",
                "high",
                "level",
                "runs",
                "finite",
                "seed"
              ],
              "additionalProperties": {},
              "description": "The bootstrap interval of `first`. Only the option `interval` writes this field."
            },
            "totalInterval": {
              "type": "object",
              "properties": {
                "estimate": {
                  "type": "number",
                  "description": "The statistic of all the data."
                },
                "low": {
                  "type": "number"
                },
                "high": {
                  "type": "number"
                },
                "level": {
                  "type": "number"
                },
                "runs": {
                  "type": "number"
                },
                "finite": {
                  "type": "number",
                  "description": "The number of runs whose statistic is a finite number. Only these runs make the interval."
                },
                "seed": {
                  "type": "number",
                  "description": "The seed as a 32-bit number."
                },
                "against": {
                  "type": "number",
                  "description": "The value of the option `against`."
                },
                "pAbove": {
                  "type": "number",
                  "description": "The p of the claim \"the statistic is above `against`\": (1 + the finite runs at or below `against`) / (finite + 1)."
                },
                "pBelow": {
                  "type": "number",
                  "description": "The p of the claim \"the statistic is below `against`\": (1 + the finite runs at or above `against`) / (finite + 1)."
                }
              },
              "required": [
                "estimate",
                "low",
                "high",
                "level",
                "runs",
                "finite",
                "seed"
              ],
              "additionalProperties": {},
              "description": "The bootstrap interval of `total`. Only the option `interval` writes this field."
            }
          },
          "required": [
            "dimension",
            "first",
            "total"
          ],
          "additionalProperties": {}
        },
        "description": "The indices of each dimension of the record, in the order of the record."
      }
    },
    "required": [
      "measure",
      "scale",
      "n",
      "evaluations",
      "seed",
      "mean",
      "variance",
      "indices"
    ],
    "additionalProperties": {}
  }
}