Ir al contenido
GET /v1/linear

Fit a regression line

Pruébalo en vivo

10 llamadas gratis al día — sin registro, sin clave API. Pasa por el gateway de oanor.

Encabezados personalizados (opcional)
api.oanor.com/regression-api

Funciona. Consigue una clave API y úsala en tu proyecto.

Obtener una clave API

Fragmentos de código

curl "https://api.oanor.com/regression-api/v1/linear" \
  -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/regression-api/v1/linear", {
  headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/regression-api/v1/linear");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-oanor-key: oanor_test_..."]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
import requests
requests.get(
    "https://api.oanor.com/regression-api/v1/linear",
    headers={"x-oanor-key": "oanor_test_..."}
)

Respuesta de ejemplo

Una respuesta real de este endpoint, capturada en la última comprobación de estado.

{
    "data": {
        "r": 0.77459667,
        "note": "Ordinary least-squares fit y = a + b·x. b = Σ((x−x̄)(y−ȳ))/Σ(x−x̄)², a = ȳ − b·x̄, R² is the fraction of variance explained.",
        "slope": 0.6,
        "inputs": {
            "n": 5
        },
        "equation": "y = 2.2 + 0.6·x",
        "intercept": 2.2,
        "r_squared": 0.6,
        "prediction": {
            "x": 6,
            "y": 5.8
        },
        "slope_std_error": 0.28284271,
        "residual_std_error": 0.89442719
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:22.616Z",
        "request_id": "8b93fb5f-c609-4e80-9684-6a614553fc76"
    },
    "status": "ok",
    "message": "Linear regression",
    "success": true
}