API ReferenceapianalyticsPOST /cohort/regression

POST /cohort/regression

Service: analytics · operationId: (none)

Required scopes

(no scope declared — review service config)

Request body

{
  "type": "object",
  "properties": {
    "x": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "number"
          }
        },
        {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "number"
            }
          }
        }
      ]
    },
    "y": {
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "method": {
      "type": "string",
      "enum": [
        "linear",
        "logistic"
      ],
      "default": "linear"
    },
    "alpha": {
      "type": "number",
      "default": 0.05
    },
    "max_iter": {
      "type": [
        "integer",
        "null"
      ]
    }
  },
  "required": [
    "x",
    "y"
  ]
}

Responses

200 Regression completed

{
  "type": "object",
  "properties": {
    "method": {
      "type": "string",
      "enum": [
        "linear",
        "logistic"
      ]
    },
    "sample_size": {
      "type": "integer"
    },
    "feature_count": {
      "type": "integer"
    },
    "intercept": {
      "type": "number"
    },
    "coefficients": {
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "predictions": {
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "r_squared": {
      "type": [
        "number",
        "null"
      ]
    },
    "adjusted_r_squared": {
      "type": [
        "number",
        "null"
      ]
    },
    "residual_standard_error": {
      "type": [
        "number",
        "null"
      ]
    },
    "pseudo_r_squared": {
      "type": [
        "number",
        "null"
      ]
    },
    "accuracy": {
      "type": [
        "number",
        "null"
      ]
    },
    "odds_ratios": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "number"
      }
    },
    "predicted_probabilities": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "number"
      }
    },
    "p_values": {
      "type": "object",
      "properties": {
        "intercept": {
          "type": "number"
        },
        "coefficients": {
          "type": "array",
          "items": {
            "type": "number"
          }
        }
      },
      "required": [
        "intercept",
        "coefficients"
      ]
    },
    "confidence_intervals": {
      "type": "object",
      "properties": {
        "intercept": {
          "type": "object",
          "properties": {
            "low": {
              "type": "number"
            },
            "high": {
              "type": "number"
            }
          },
          "required": [
            "low",
            "high"
          ]
        },
        "coefficients": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "low": {
                "type": "number"
              },
              "high": {
                "type": "number"
              }
            },
            "required": [
              "low",
              "high"
            ]
          }
        }
      },
      "required": [
        "intercept",
        "coefficients"
      ]
    },
    "significant": {
      "type": "object",
      "properties": {
        "intercept": {
          "type": "boolean"
        },
        "coefficients": {
          "type": "array",
          "items": {
            "type": "boolean"
          }
        }
      },
      "required": [
        "intercept",
        "coefficients"
      ]
    },
    "slope": {
      "type": [
        "number",
        "null"
      ]
    },
    "odds_ratio": {
      "type": [
        "number",
        "null"
      ]
    }
  },
  "required": [
    "method",
    "sample_size",
    "feature_count",
    "intercept",
    "coefficients",
    "predictions",
    "r_squared",
    "adjusted_r_squared",
    "residual_standard_error",
    "pseudo_r_squared",
    "accuracy",
    "odds_ratios",
    "predicted_probabilities",
    "p_values",
    "confidence_intervals",
    "significant",
    "slope",
    "odds_ratio"
  ]
}

400 Invalid request

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

Example

curl -X POST https://analytics.platform.loop.health/cohort/regression \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'