API ReferenceapianalyticsPOST /cohort/trend

POST /cohort/trend

Service: analytics · operationId: (none)

Required scopes

(no scope declared — review service config)

Request body

{
  "type": "object",
  "properties": {
    "values": {
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "x": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "number"
      }
    },
    "alpha": {
      "type": "number",
      "default": 0.05
    }
  },
  "required": [
    "values"
  ]
}

Responses

200 Trend analysis completed

{
  "type": "object",
  "properties": {
    "method": {
      "type": "string",
      "enum": [
        "linear_regression"
      ]
    },
    "sample_size": {
      "type": "integer"
    },
    "slope": {
      "type": "number"
    },
    "intercept": {
      "type": "number"
    },
    "r_value": {
      "type": "number"
    },
    "r_squared": {
      "type": "number"
    },
    "p_value": {
      "type": "number"
    },
    "standard_error": {
      "type": "number"
    },
    "confidence_interval": {
      "type": "object",
      "properties": {
        "low": {
          "type": "number"
        },
        "high": {
          "type": "number"
        }
      },
      "required": [
        "low",
        "high"
      ]
    },
    "significant": {
      "type": "boolean"
    },
    "direction": {
      "type": "string",
      "enum": [
        "increasing",
        "decreasing",
        "stable"
      ]
    },
    "predictions": {
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "residual_standard_deviation": {
      "type": "number"
    }
  },
  "required": [
    "method",
    "sample_size",
    "slope",
    "intercept",
    "r_value",
    "r_squared",
    "p_value",
    "standard_error",
    "confidence_interval",
    "significant",
    "direction",
    "predictions",
    "residual_standard_deviation"
  ]
}

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/trend \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'